nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 srcOnly,
4 makeSetupHook,
5 makeWrapper,
6 nodejs,
7 jq,
8 prefetch-npm-deps,
9 diffutils,
10 installShellFiles,
11 nodejsInstallManuals,
12 nodejsInstallExecutables,
13}:
14
15{
16 npmConfigHook = makeSetupHook {
17 name = "npm-config-hook";
18 substitutions = {
19 nodeSrc = srcOnly nodejs;
20 nodeGyp = "${nodejs}/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js";
21
22 # Specify `diff`, `jq`, and `prefetch-npm-deps` by abspath to ensure that the user's build
23 # inputs do not cause us to find the wrong binaries.
24 diff = "${diffutils}/bin/diff";
25 jq = "${jq}/bin/jq";
26 prefetchNpmDeps = "${prefetch-npm-deps}/bin/prefetch-npm-deps";
27
28 nodeVersion = nodejs.version;
29 nodeVersionMajor = lib.versions.major nodejs.version;
30 };
31 } ./npm-config-hook.sh;
32
33 npmBuildHook = makeSetupHook {
34 name = "npm-build-hook";
35 } ./npm-build-hook.sh;
36
37 npmInstallHook = makeSetupHook {
38 name = "npm-install-hook";
39 propagatedBuildInputs = [
40 installShellFiles
41 makeWrapper
42 nodejsInstallManuals
43 (nodejsInstallExecutables.override {
44 inherit nodejs;
45 })
46 ];
47 substitutions = {
48 jq = "${jq}/bin/jq";
49 };
50 } ./npm-install-hook.sh;
51}