Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 writeShellApplication,
3 pnpm,
4 pnpmDeps,
5}:
6
7writeShellApplication {
8 name = "serve-pnpm-store";
9
10 runtimeInputs = [
11 pnpm
12 ];
13
14 text = ''
15 storePath=$(mktemp -d)
16
17 clean() {
18 echo "Cleaning up temporary store at '$storePath'..."
19
20 rm -rf "$storePath"
21 }
22
23 echo "Copying pnpm store '${pnpmDeps}' to temporary store..."
24
25 cp -Tr "${pnpmDeps}" "$storePath"
26 chmod -R +w "$storePath"
27
28 echo "Run 'pnpm install --store-dir \"$storePath\"' to install packages from this store."
29
30 trap clean EXIT
31
32 pnpm server start \
33 --store-dir "$storePath"
34 '';
35}