2024-05-28 12:43:04 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2017-11-11 01:51:34 +03:00
|
|
|
source common.sh
|
|
|
|
|
2024-06-16 17:56:50 +02:00
|
|
|
TODO_NixOS # NixOS doesn't provide $NIX_STATE_DIR (and shouldn't)
|
2024-06-16 12:51:46 +02:00
|
|
|
|
2017-11-11 01:51:34 +03: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-11 01:51:34 +03:00
|
|
|
|
|
|
|
# Check that file exists.
|
|
|
|
[ "$(cat $(cat $outPath))" = "Hello World!" ]
|
|
|
|
|
|
|
|
nix-collect-garbage
|
|
|
|
|
|
|
|
# Check that file still exists.
|
|
|
|
[ "$(cat $(cat $outPath))" = "Hello World!" ]
|