diff options
author | happysalada <raphael@megzari.com> | 2023-11-09 18:51:35 +0100 |
---|---|---|
committer | Yt <happysalada@tuta.io> | 2023-11-16 11:57:48 +0000 |
commit | 7fb490674fbe789dafe09f018ae7470143ed5a3c (patch) | |
tree | 005c93baa48d52e4859541d1bd27230ee4418de6 | |
parent | 54f00576aa6139a9d54062d0edc2fb31423f0ffb (diff) | |
download | nixpkgs-7fb490674fbe789dafe09f018ae7470143ed5a3c.tar nixpkgs-7fb490674fbe789dafe09f018ae7470143ed5a3c.tar.gz nixpkgs-7fb490674fbe789dafe09f018ae7470143ed5a3c.tar.bz2 nixpkgs-7fb490674fbe789dafe09f018ae7470143ed5a3c.tar.lz nixpkgs-7fb490674fbe789dafe09f018ae7470143ed5a3c.tar.xz nixpkgs-7fb490674fbe789dafe09f018ae7470143ed5a3c.tar.zst nixpkgs-7fb490674fbe789dafe09f018ae7470143ed5a3c.zip |
buildNpmPackage: allow passing npmDeps
-rw-r--r-- | doc/languages-frameworks/javascript.section.md | 1 | ||||
-rw-r--r-- | pkgs/build-support/node/build-npm-package/default.nix | 11 |
2 files changed, 6 insertions, 6 deletions
diff --git a/doc/languages-frameworks/javascript.section.md b/doc/languages-frameworks/javascript.section.md index 0bb9959a510..152974b465a 100644 --- a/doc/languages-frameworks/javascript.section.md +++ b/doc/languages-frameworks/javascript.section.md @@ -210,6 +210,7 @@ In the default `installPhase` set by `buildNpmPackage`, it uses `npm pack --json * `npmPruneFlags`: Flags to pass to `npm prune`. Defaults to the value of `npmInstallFlags`. * `makeWrapperArgs`: Flags to pass to `makeWrapper`, added to executable calling the generated `.js` with `node` as an interpreter. These scripts are defined in `package.json`. * `nodejs`: The `nodejs` package to build against, using the corresponding `npm` shipped with that version of `node`. Defaults to `pkgs.nodejs`. +* `npmDeps`: The dependencies used to build the npm package. Especially useful to not have to recompute workspace depedencies. #### prefetch-npm-deps {#javascript-buildNpmPackage-prefetch-npm-deps} diff --git a/pkgs/build-support/node/build-npm-package/default.nix b/pkgs/build-support/node/build-npm-package/default.nix index 9babc7ae628..2aefab8ac7a 100644 --- a/pkgs/build-support/node/build-npm-package/default.nix +++ b/pkgs/build-support/node/build-npm-package/default.nix @@ -35,16 +35,15 @@ # Value for npm `--workspace` flag and directory in which the files to be installed are found. , npmWorkspace ? null , nodejs ? topLevelArgs.nodejs +, npmDeps ? fetchNpmDeps { + inherit forceGitDeps src srcs sourceRoot prePatch patches postPatch; + name = "${name}-npm-deps"; + hash = npmDepsHash; +} , ... } @ args: let - npmDeps = fetchNpmDeps { - inherit forceGitDeps src srcs sourceRoot prePatch patches postPatch; - name = "${name}-npm-deps"; - hash = npmDepsHash; - }; - # .override {} negates splicing, so we need to use buildPackages explicitly npmHooks = buildPackages.npmHooks.override { inherit nodejs; |