blob: d2293ed42f793175d681c720a9c860217b43259c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
{ lib, makeSetupHook, nodejs, srcOnly, diffutils, jq, makeWrapper }:
{
npmConfigHook = makeSetupHook
{
name = "npm-config-hook";
substitutions = {
nodeSrc = srcOnly nodejs;
# Specify the stdenv's `diff` and `jq` by abspath to ensure that the user's build
# inputs do not cause us to find the wrong binaries.
# The `.nativeDrv` stanza works like nativeBuildInputs and ensures cross-compiling has the right version available.
diff = "${diffutils.nativeDrv or diffutils}/bin/diff";
jq = "${jq.nativeDrv or jq}/bin/jq";
nodeVersion = nodejs.version;
nodeVersionMajor = lib.versions.major nodejs.version;
};
} ./npm-config-hook.sh;
npmBuildHook = makeSetupHook
{
name = "npm-build-hook";
} ./npm-build-hook.sh;
npmInstallHook = makeSetupHook
{
name = "npm-install-hook";
deps = [ makeWrapper ];
substitutions = {
hostNode = "${nodejs}/bin/node";
jq = "${jq.nativeDrv or jq}/bin/jq";
};
} ./npm-install-hook.sh;
}
|