aboutsummaryrefslogtreecommitdiff
path: root/tests/flake-local-settings.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/flake-local-settings.sh')
-rw-r--r--tests/flake-local-settings.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/flake-local-settings.sh b/tests/flake-local-settings.sh
new file mode 100644
index 000000000..09f6b4ca8
--- /dev/null
+++ b/tests/flake-local-settings.sh
@@ -0,0 +1,34 @@
+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";
+
+ outputs = a: {
+ defaultPackage.$system = import ./simple.nix;
+ };
+}
+EOF
+
+# Without --accept-flake-config, the post hook should not run.
+nix build < /dev/null
+(! [[ -f post-hook-ran ]])
+clearStore
+
+nix build --accept-flake-config
+test -f post-hook-ran || fail "The post hook should have ran"