fixup-yarn-lock: split out from prefetch-yarn-deps, cleanup installing
To reduce dependencies (mainly nix-prefetch-git and through that git, git-lfs) when we just need to fixup a lock file, eg when building electron. This also tries to avoid needless rebuilds when eg. golang is updated. Also this cleans up and combined the build/installPhase of both tools to be a lot simpler.
This commit is contained in:
parent
b6f3d2497b
commit
6181939cdf
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user