diff --git a/pkgs/build-support/node/fetch-yarn-deps/default.nix b/pkgs/build-support/node/fetch-yarn-deps/default.nix index e837f7457d17..7f0e0692f81f 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 ]; - - buildPhase = '' - runHook preBuild - - 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 - - runHook postBuild - ''; + buildInputs = [ nodejs-slim ]; installPhase = '' runHook preInstall - mkdir -p $out/bin - cp -r libexec $out + 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 ${./.}/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 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 $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 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d5fde0d2239c..50e0bd476af2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1022,6 +1022,7 @@ with pkgs; fetchpijul = callPackage ../build-support/fetchpijul { }; inherit (callPackages ../build-support/node/fetch-yarn-deps { }) + fixup-yarn-lock prefetch-yarn-deps fetchYarnDeps;