about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/node/fetch-yarn-deps/default.nix44
1 files changed, 32 insertions, 12 deletions
diff --git a/pkgs/build-support/node/fetch-yarn-deps/default.nix b/pkgs/build-support/node/fetch-yarn-deps/default.nix
index e837f7457d176..7f0e0692f81f6 100644
--- a/pkgs/build-support/node/fetch-yarn-deps/default.nix
+++ b/pkgs/build-support/node/fetch-yarn-deps/default.nix
@@ -13,29 +13,49 @@ in {
     name = "prefetch-yarn-deps";
 
     dontUnpack = true;
+    dontBuild = true;
 
     nativeBuildInputs = [ makeWrapper ];
-    buildInputs = [ coreutils nix-prefetch-git nodejs-slim nix ];
+    buildInputs = [ nodejs-slim ];
 
-    buildPhase = ''
-      runHook preBuild
+    installPhase = ''
+      runHook preInstall
+
+      mkdir -p $out/bin $out/libexec
 
-      mkdir libexec
       tar --strip-components=1 -xf ${yarnpkg-lockfile-tar} package/index.js
-      mv index.js libexec/yarnpkg-lockfile.js
-      cp ${./.}/*.js libexec/
-      patchShebangs libexec
+      mv index.js $out/libexec/yarnpkg-lockfile.js
+      cp ${./.}/common.js ${./.}/index.js $out/libexec/
+
+      patchShebangs $out/libexec
+      makeWrapper $out/libexec/index.js $out/bin/prefetch-yarn-deps \
+        --prefix PATH : ${lib.makeBinPath [ coreutils nix-prefetch-git nix ]}
 
-      runHook postBuild
+      runHook postInstall
     '';
 
+    passthru = { inherit tests; };
+  };
+
+  fixup-yarn-lock = stdenv.mkDerivation {
+    name = "fixup-yarn-lock";
+
+    dontUnpack = true;
+    dontBuild = true;
+
+    nativeBuildInputs = [ makeWrapper ];
+    buildInputs = [ nodejs-slim ];
+
     installPhase = ''
       runHook preInstall
 
-      mkdir -p $out/bin
-      cp -r libexec $out
-      makeWrapper $out/libexec/index.js $out/bin/prefetch-yarn-deps \
-        --prefix PATH : ${lib.makeBinPath [ coreutils nix-prefetch-git nix ]}
+      mkdir -p $out/bin $out/libexec
+
+      tar --strip-components=1 -xf ${yarnpkg-lockfile-tar} package/index.js
+      mv index.js $out/libexec/yarnpkg-lockfile.js
+      cp ${./.}/common.js ${./.}/fixup.js $out/libexec/
+
+      patchShebangs $out/libexec
       makeWrapper $out/libexec/fixup.js $out/bin/fixup-yarn-lock
 
       runHook postInstall