mirror of
https://github.com/NixOS/nix
synced 2025-07-09 03:43:54 +02:00
Make the flake options work when using the daemon
When setting flake-local options (with the `nixConfig` field), forward
these options to the daemon in case we’re using one.
This is necessary in particular for options like `binary-caches` or
`post-build-hook` to make sense.
Fix <343239fc8a (r44356843)
>
This commit is contained in:
parent
7d6017b7a9
commit
1f3c3a3785
6 changed files with 48 additions and 1 deletions
35
tests/flake-local-settings.sh
Normal file
35
tests/flake-local-settings.sh
Normal file
|
@ -0,0 +1,35 @@
|
|||
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
|
||||
|
||||
# Ugly hack for testing
|
||||
mkdir -p .local/share/nix
|
||||
cat <<EOF > .local/share/nix/trusted-settings.json
|
||||
{"post-build-hook":{"$PWD/echoing-post-hook.sh":true}}
|
||||
EOF
|
||||
|
||||
nix build
|
||||
test -f post-hook-ran || fail "The post hook should have ran"
|
|
@ -46,6 +46,7 @@ nix_tests = \
|
|||
recursive.sh \
|
||||
describe-stores.sh \
|
||||
flakes.sh \
|
||||
flake-local-settings.sh \
|
||||
build.sh \
|
||||
compute-levels.sh \
|
||||
repl.sh \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue