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