Retire staged Yarn dependencies during Nix installation (#473)
This commit is contained in:
parent
43fcf6b27a
commit
a962586381
@@ -0,0 +1,31 @@
|
||||
# Tiny generated-project interface fixture. Real offline Yarn installation
|
||||
# remains covered by the consuming Studio and Package-builder checks.
|
||||
{ stdenvNoCC, nodejs }:
|
||||
{ src, overrideAttrs ? null }:
|
||||
let
|
||||
project = stdenvNoCC.mkDerivation {
|
||||
name = "yarn-dependencies-transfer-fixture";
|
||||
inherit src;
|
||||
configurePhase = ''
|
||||
mkdir -p node_modules/fixture node_modules/.bin .yarn/cache
|
||||
printf '%s\n' '{"main":"index.cjs"}' > node_modules/fixture/package.json
|
||||
printf '%s\n' 'module.exports = {value: "retained dependency"};' > node_modules/fixture/index.cjs
|
||||
ln node_modules/fixture/index.cjs node_modules/fixture/twin.cjs
|
||||
ln -s fixture node_modules/alias
|
||||
printf '%s\n' '#!${nodejs}/bin/node' 'console.log("linked executable");' > node_modules/fixture/cli.cjs
|
||||
chmod +x node_modules/fixture/cli.cjs
|
||||
ln -s ../fixture/cli.cjs node_modules/.bin/fixture
|
||||
printf '%s\n' 'hidden dependency data' > node_modules/.fixture-data
|
||||
printf '%s\n' 'disposable linker state' > node_modules/.yarn-state.yml
|
||||
printf '%s\n' 'disposable archive' > .yarn/cache/fixture.zip
|
||||
'';
|
||||
postInstall = ''
|
||||
test ! -e node_modules
|
||||
test ! -e .yarn/cache
|
||||
test ! -e "$out/.yarn-state.yml"
|
||||
test ! -e "$out/node_modules"
|
||||
test "$(stat -c %i "$out/fixture/index.cjs")" = "$(stat -c %i "$out/fixture/twin.cjs")"
|
||||
'';
|
||||
};
|
||||
in
|
||||
if overrideAttrs == null then project else project.overrideAttrs overrideAttrs
|
||||
Reference in New Issue
Block a user