mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-17 10:24:07 +00:00
728d48285e
This script allows users to reuse the cached dependencies outside of derivations. Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
31 lines
594 B
Nix
31 lines
594 B
Nix
{ writeShellApplication, pnpm, pnpmDeps }:
|
|
writeShellApplication {
|
|
name = "serve-pnpm-store";
|
|
|
|
runtimeInputs = [
|
|
pnpm
|
|
];
|
|
|
|
text = ''
|
|
storePath=$(mktemp -d)
|
|
|
|
clean() {
|
|
echo "Cleaning up temporary store at '$storePath'..."
|
|
|
|
rm -rf "$storePath"
|
|
}
|
|
|
|
echo "Copying pnpm store '${pnpmDeps}' to temporary store..."
|
|
|
|
cp -Tr "${pnpmDeps}" "$storePath"
|
|
chmod -R +w "$storePath"
|
|
|
|
echo "Run 'pnpm install --store-dir \"$storePath\"' to install packages from this store."
|
|
|
|
trap clean EXIT
|
|
|
|
pnpm server start \
|
|
--store-dir "$storePath"
|
|
'';
|
|
}
|