aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2021-11-12 16:28:39 +0100
committerregnat <rg@regnat.ovh>2021-12-17 09:31:13 +0100
commitab902521b131c6a642d8cdcfe28d61b5dfe764a2 (patch)
treee3bdd4684832fea64f6a80db8d0704f548eaaa31 /tests
parentc260640dec6e35c714b666a1e7adede5aab6972a (diff)
Allow paths in flake local settings
Fix #5505
Diffstat (limited to 'tests')
-rw-r--r--tests/flake-local-settings.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/flake-local-settings.sh b/tests/flake-local-settings.sh
index 98ad60174..7765fe379 100644
--- a/tests/flake-local-settings.sh
+++ b/tests/flake-local-settings.sh
@@ -11,13 +11,13 @@ rm -f post-hook-ran
cat <<EOF > echoing-post-hook.sh
#!/bin/sh
-echo "ThePostHookRan" > $PWD/post-hook-ran
+echo "ThePostHookRan as \$0" > $PWD/post-hook-ran
EOF
chmod +x echoing-post-hook.sh
cat <<EOF > flake.nix
{
- nixConfig.post-build-hook = "$PWD/echoing-post-hook.sh";
+ nixConfig.post-build-hook = ./echoing-post-hook.sh;
nixConfig.allow-dirty = false; # See #5621
outputs = a: {
@@ -33,3 +33,13 @@ clearStore
nix build --accept-flake-config
test -f post-hook-ran || fail "The post hook should have ran"
+
+# Make sure that the path to the post hook doesn’t change if we change
+# something in the flake.
+# Otherwise the user would have to re-validate the setting each time.
+mv post-hook-ran previous-post-hook-run
+echo "# Dummy comment" >> flake.nix
+clearStore
+nix build --accept-flake-config
+diff -q post-hook-ran previous-post-hook-run || \
+ fail "Both post hook runs should report the same filename"