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