about summary refs log tree commit diff
path: root/pkgs/build-support/node
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/node')
-rw-r--r--pkgs/build-support/node/build-npm-package/default.nix4
-rw-r--r--pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh2
-rw-r--r--pkgs/build-support/node/fetch-npm-deps/default.nix8
-rw-r--r--pkgs/build-support/node/fetch-npm-deps/src/main.rs2
4 files changed, 9 insertions, 7 deletions
diff --git a/pkgs/build-support/node/build-npm-package/default.nix b/pkgs/build-support/node/build-npm-package/default.nix
index 5ab86996e56b2..26cc678c571e7 100644
--- a/pkgs/build-support/node/build-npm-package/default.nix
+++ b/pkgs/build-support/node/build-npm-package/default.nix
@@ -4,7 +4,9 @@
 , src ? null
 , srcs ? null
 , sourceRoot ? null
+, prePatch ? ""
 , patches ? [ ]
+, postPatch ? ""
 , nativeBuildInputs ? [ ]
 , buildInputs ? [ ]
   # The output hash of the dependencies for this project.
@@ -30,7 +32,7 @@
 
 let
   npmDeps = fetchNpmDeps {
-    inherit src srcs sourceRoot patches;
+    inherit src srcs sourceRoot prePatch patches postPatch;
     name = "${name}-npm-deps";
     hash = npmDepsHash;
   };
diff --git a/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh b/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh
index c3983e2895681..59ea2da993d87 100644
--- a/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh
+++ b/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh
@@ -27,7 +27,7 @@ npmInstallHook() {
     local -r nodeModulesPath="$packageOut/node_modules"
 
     if [ ! -d "$nodeModulesPath" ]; then
-        npm prune --omit dev $npmInstallFlags "${npmInstallFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"
+        npm prune --omit dev --no-save $npmInstallFlags "${npmInstallFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"
         find node_modules -maxdepth 1 -type d -empty -delete
 
         cp -r node_modules "$nodeModulesPath"
diff --git a/pkgs/build-support/node/fetch-npm-deps/default.nix b/pkgs/build-support/node/fetch-npm-deps/default.nix
index 7d5ea7cbfbe8f..7d6277df987f3 100644
--- a/pkgs/build-support/node/fetch-npm-deps/default.nix
+++ b/pkgs/build-support/node/fetch-npm-deps/default.nix
@@ -84,7 +84,7 @@
             hash = "sha256-X9mCwPqV5yP0S2GonNvpYnLSLJMd/SUIked+hMRxDpA=";
           };
 
-          hash = "sha256-5Mg7KDJLMM5e/7BCHGinGAnBRft2ySQzvKW06p3u/0o=";
+          hash = "sha256-tEdElWJ+KBTxBobzXBpPopQSwK2usGW/it1+yfbVzBw=";
         };
 
         linkDependencies = makeTest {
@@ -107,7 +107,7 @@
             hash = "sha256-1fGNxYJi1I4cXK/jinNG+Y6tPEOhP3QAqWOBEQttS9E=";
           };
 
-          hash = "sha256-8xF8F74nHwL9KPN2QLsxnfvsk0rNCKOZniYJQCD5u/I=";
+          hash = "sha256-+KA8/orSBJ4EhuSyQO8IKSxsN/FAsYU3lOzq+awuxNQ=";
         };
       };
 
@@ -140,14 +140,14 @@
       buildPhase = ''
         runHook preBuild
 
-        if [[ ! -f package-lock.json ]]; then
+        if [[ ! -e package-lock.json ]]; then
           echo
           echo "ERROR: The package-lock.json file does not exist!"
           echo
           echo "package-lock.json is required to make sure that npmDepsHash doesn't change"
           echo "when packages are updated on npm."
           echo
-          echo "Hint: You can use the patches attribute to add a package-lock.json manually to the build."
+          echo "Hint: You can copy a vendored package-lock.json file via postPatch."
           echo
 
           exit 1
diff --git a/pkgs/build-support/node/fetch-npm-deps/src/main.rs b/pkgs/build-support/node/fetch-npm-deps/src/main.rs
index cf9651d42d649..3d2204071a66a 100644
--- a/pkgs/build-support/node/fetch-npm-deps/src/main.rs
+++ b/pkgs/build-support/node/fetch-npm-deps/src/main.rs
@@ -421,7 +421,7 @@ fn main() -> anyhow::Result<()> {
                 data = Command::new("tar")
                     .args([
                         "--sort=name",
-                        "--mtime=0",
+                        "--mtime=@0",
                         "--owner=0",
                         "--group=0",
                         "--numeric-owner",