2021-11-05 15:17:49 +00:00
|
|
|
source common.sh
|
|
|
|
|
|
|
|
clearStore
|
|
|
|
rm -rf $TEST_HOME/.cache $TEST_HOME/.config $TEST_HOME/.local
|
|
|
|
|
|
|
|
cp ./simple.nix ./simple.builder.sh ./config.nix $TEST_HOME
|
|
|
|
|
|
|
|
cd $TEST_HOME
|
|
|
|
|
|
|
|
rm -f post-hook-ran
|
|
|
|
cat <<EOF > echoing-post-hook.sh
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
echo "ThePostHookRan" > $PWD/post-hook-ran
|
|
|
|
EOF
|
|
|
|
chmod +x echoing-post-hook.sh
|
|
|
|
|
|
|
|
cat <<EOF > flake.nix
|
|
|
|
{
|
|
|
|
nixConfig.post-build-hook = "$PWD/echoing-post-hook.sh";
|
2021-12-14 08:15:24 +00:00
|
|
|
nixConfig.allow-dirty = false; # See #5621
|
2021-11-05 15:17:49 +00:00
|
|
|
|
|
|
|
outputs = a: {
|
|
|
|
defaultPackage.$system = import ./simple.nix;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
2021-11-18 12:32:52 +00:00
|
|
|
# Without --accept-flake-config, the post hook should not run.
|
|
|
|
nix build < /dev/null
|
|
|
|
(! [[ -f post-hook-ran ]])
|
|
|
|
clearStore
|
|
|
|
|
2021-11-12 15:02:32 +00:00
|
|
|
nix build --accept-flake-config
|
2021-11-05 15:17:49 +00:00
|
|
|
test -f post-hook-ran || fail "The post hook should have ran"
|