Files
quixos-nix-helpers/yarn-dependencies.nix
T

33 lines
742 B
Nix

{
pkgs,
src,
nodejs ? pkgs.nodejs_24,
}:
let
project = (pkgs.callPackage (src + "/yarn-project.nix") { inherit nodejs; }) {
inherit src;
overrideAttrs = _: {
buildPhase = "runHook preBuild; runHook postBuild";
installPhase = ''
runHook preInstall
test -d node_modules
mkdir -p "$out"
cp -a node_modules/. "$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"
runHook postInstall
'';
};
};
in
project
// {
devShell = pkgs.mkShell {
packages = [
nodejs
project.yarn-freestanding
];
};
}