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