2024-05-28 19:43:04 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2017-11-11 00:51:34 +02:00
|
|
|
source common.sh
|
|
|
|
|
2024-06-16 18:56:50 +03:00
|
|
|
TODO_NixOS # NixOS doesn't provide $NIX_STATE_DIR (and shouldn't)
|
2024-06-16 13:51:46 +03:00
|
|
|
|
2017-11-11 00:51:34 +02:00
|
|
|
clearStore
|
|
|
|
|
|
|
|
outPath=$(nix-build --no-out-link readfile-context.nix)
|
|
|
|
|
|
|
|
# Set a GC root.
|
2024-06-12 19:42:38 +03:00
|
|
|
ln -s $outPath "$NIX_STATE_DIR/gcroots/foo"
|
2017-11-11 00:51:34 +02:00
|
|
|
|
|
|
|
# Check that file exists.
|
|
|
|
[ "$(cat $(cat $outPath))" = "Hello World!" ]
|
|
|
|
|
|
|
|
nix-collect-garbage
|
|
|
|
|
|
|
|
# Check that file still exists.
|
|
|
|
[ "$(cat $(cat $outPath))" = "Hello World!" ]
|