Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameterize the command that install dependencies #111

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
- **installCommands** *(default `[ "npm install --offline --nodedir=${nodeSource nodejs}" ]`)*: List of commands 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).

Expand Down
3 changes: 2 additions & 1 deletion internal.nix
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ rec {
, buildInputs ? [ ]
, nativeBuildInputs ? [ ]
, nodejs ? default_nodejs
, installCommands ? [ "npm install --offline --nodedir=${nodeSource nodejs}" ]
, preBuild ? ""
, postBuild ? ""
, preInstallLinks ? { } # set that describes which files should be linked in a specific packages folder
Expand Down Expand Up @@ -373,7 +374,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}
${lib.concatStringsSep "\n" installCommands}
test -d node_modules/.bin && patchShebangs node_modules/.bin
rm -rf node_modules/.hooks
runHook postBuild
Expand Down