Retire staged Yarn dependencies during Nix installation (#473)
This commit is contained in:
parent
43fcf6b27a
commit
a962586381
@@ -9,10 +9,18 @@ let
|
||||
overrideAttrs = _: {
|
||||
buildPhase = "runHook preBuild; runHook postBuild";
|
||||
installPhase = ''
|
||||
set -o pipefail
|
||||
runHook preInstall
|
||||
test -d node_modules
|
||||
test ! -L node_modules
|
||||
mkdir -p "$out"
|
||||
cp -a node_modules/. "$out/"
|
||||
# Installation is finished: retire its disposable archive cache, then
|
||||
# stream dependencies across the build/store mount boundary without
|
||||
# retaining a second complete tree. This is the same installation
|
||||
# policy used by Central's dependency derivations.
|
||||
rm -rf .yarn/cache
|
||||
${pkgs.gnutar}/bin/tar --create --file=- --remove-files node_modules \
|
||||
| ${pkgs.gnutar}/bin/tar --extract --file=- --strip-components=1 --directory="$out"
|
||||
# Node resolves installed packages directly. This generated index is for
|
||||
# Yarn's linker, not a runtime input; do not export build-session state.
|
||||
rm -f "$out/.yarn-state.yml"
|
||||
|
||||
Reference in New Issue
Block a user