From e07031b578fef6d890cae96b653590cba4d206d0 Mon Sep 17 00:00:00 2001 From: ilkecan Date: Sat, 25 Sep 2021 23:34:30 +0300 Subject: [PATCH] Parameterize the command that install dependencies --- API.md | 1 + internal.nix | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/API.md b/API.md index ea50b97..cc12c54 100644 --- a/API.md +++ b/API.md @@ -14,6 +14,7 @@ The `node_modules` function takes an attribute set with the following attributes - **packageJson** *(default `src+"/package.json"`)*: Path to `package.json` - **packageLockJson** *(default `src+"/package-lock.json"`)*: Path to `package-lock.json` - **nodejs** *(default `nixpkgs.nodejs`, which is the Active LTS version)*: Node.js derivation to use +- **npmCmd** *(default `npm install --offline`)*: npm command to install dependencies - **preInstallLinks** *(default `{}`)*: Map of symlinks to create inside npm dependencies in the `node_modules` output (See [Concepts](#concepts) for details). - **githubSourceHashMap** *(default `{}`)*: Dependency hashes for evaluation in restricted mode (See [Concepts](#concepts) for details). diff --git a/internal.nix b/internal.nix index 2bdc572..9e43cc5 100644 --- a/internal.nix +++ b/internal.nix @@ -290,6 +290,7 @@ rec { , buildInputs ? [ ] , nativeBuildInputs ? [ ] , nodejs ? default_nodejs + , npmCmd ? "npm install --offline" , preBuild ? "" , postBuild ? "" , preInstallLinks ? { } # set that describes which files should be linked in a specific packages folder @@ -385,7 +386,7 @@ rec { declare -pf > $TMP/preinstall-env ln -s ${preinstall_node_modules}/node_modules/.hooks/prepare node_modules/.hooks/preinstall export HOME=. - npm install --offline --nodedir=${nodeSource nodejs} + ${npmCmd} --nodedir=${nodeSource nodejs} test -d node_modules/.bin && patchShebangs node_modules/.bin rm -rf node_modules/.hooks runHook postBuild