forked from mirrors/nixpkgs
009a234bdd
Previously, we stored the tarballs from the hosted Git providers directly in the cache. However, as we've seen with `fetchFromGitHub` etc, these files may change subtly. Given this, this commit repacks the dependencies before storing them in the cache.
36 lines
1 KiB
Nix
36 lines
1 KiB
Nix
{ lib, makeSetupHook, nodejs, srcOnly, buildPackages, makeWrapper }:
|
|
|
|
{
|
|
npmConfigHook = makeSetupHook
|
|
{
|
|
name = "npm-config-hook";
|
|
substitutions = {
|
|
nodeSrc = srcOnly nodejs;
|
|
|
|
# Specify `diff`, `jq`, and `prefetch-npm-deps` by abspath to ensure that the user's build
|
|
# inputs do not cause us to find the wrong binaries.
|
|
diff = "${buildPackages.diffutils}/bin/diff";
|
|
jq = "${buildPackages.jq}/bin/jq";
|
|
prefetchNpmDeps = "${buildPackages.prefetch-npm-deps}/bin/prefetch-npm-deps";
|
|
|
|
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 = "${buildPackages.jq}/bin/jq";
|
|
};
|
|
} ./npm-install-hook.sh;
|
|
}
|