yarnConfigHook: init
This commit is contained in:
parent
1151b39c24
commit
a84f3ca3d8
@ -7,6 +7,9 @@
|
||||
fetchurl,
|
||||
nodejs-slim,
|
||||
prefetch-yarn-deps,
|
||||
fixup-yarn-lock,
|
||||
yarn,
|
||||
makeSetupHook,
|
||||
cacert,
|
||||
callPackage,
|
||||
nix,
|
||||
@ -154,4 +157,15 @@ in
|
||||
);
|
||||
in
|
||||
lib.setFunctionArgs f (lib.functionArgs f) // { inherit tests; };
|
||||
|
||||
yarnConfigHook = makeSetupHook {
|
||||
name = "yarn-config-hook";
|
||||
propagatedBuildInputs = [
|
||||
yarn
|
||||
fixup-yarn-lock
|
||||
];
|
||||
meta = {
|
||||
description = "Install nodejs dependencies from an offline yarn cache produced by fetchYarnDeps";
|
||||
};
|
||||
} ./yarn-config-hook.sh;
|
||||
}
|
||||
|
37
pkgs/build-support/node/fetch-yarn-deps/yarn-config-hook.sh
Normal file
37
pkgs/build-support/node/fetch-yarn-deps/yarn-config-hook.sh
Normal file
@ -0,0 +1,37 @@
|
||||
yarnConfigHook(){
|
||||
runHook preConfigure
|
||||
echo "Executing yarnConfigHook"
|
||||
|
||||
# Use a constant HOME directory
|
||||
mkdir -p /tmp/home
|
||||
export HOME=/tmp/home
|
||||
if [[ -n "$yarnOfflineCache" ]]; then
|
||||
offlineCache="$yarnOfflineCache"
|
||||
fi
|
||||
if [[ -z "$offlineCache" ]]; then
|
||||
echo yarnConfigHook: No yarnOfflineCache or offlineCache were defined\! >&2
|
||||
exit 2
|
||||
fi
|
||||
yarn config --offline set yarn-offline-mirror "$offlineCache"
|
||||
fixup-yarn-lock yarn.lock
|
||||
yarn install \
|
||||
--frozen-lockfile \
|
||||
--force \
|
||||
--production=false \
|
||||
--ignore-engines \
|
||||
--ignore-platform \
|
||||
--ignore-scripts \
|
||||
--no-progress \
|
||||
--non-interactive \
|
||||
--offline
|
||||
|
||||
# TODO: Check if this is really needed
|
||||
patchShebangs node_modules
|
||||
|
||||
echo "finished yarnConfigHook"
|
||||
runHook postConfigure
|
||||
}
|
||||
|
||||
if [[ -z "${dontYarnInstallDeps-}" && -z "${configurePhase-}" ]]; then
|
||||
configurePhase=yarnConfigHook
|
||||
fi
|
@ -986,6 +986,7 @@ with pkgs;
|
||||
inherit (callPackages ../build-support/node/fetch-yarn-deps { })
|
||||
fixup-yarn-lock
|
||||
prefetch-yarn-deps
|
||||
yarnConfigHook
|
||||
fetchYarnDeps;
|
||||
|
||||
find-cursor = callPackage ../tools/X11/find-cursor { };
|
||||
|
Loading…
Reference in New Issue
Block a user