File tree Expand file tree Collapse file tree 6 files changed +48
-1
lines changed Expand file tree Collapse file tree 6 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -307,7 +307,7 @@ LockedFlake lockFlake(
307307
308308 if (lockFlags.applyNixConfig ) {
309309 flake.config .apply ();
310- // FIXME: send new config to the daemon.
310+ state. store -> setOptions ();
311311 }
312312
313313 try {
Original file line number Diff line number Diff line change @@ -290,6 +290,10 @@ ConnectionHandle RemoteStore::getConnection()
290290 return ConnectionHandle (connections->get ());
291291}
292292
293+ void RemoteStore::setOptions ()
294+ {
295+ setOptions (*(getConnection ().handle ));
296+ }
293297
294298bool RemoteStore::isValidPathUncached (const StorePath & path)
295299{
Original file line number Diff line number Diff line change @@ -147,6 +147,8 @@ protected:
147147
148148 virtual void setOptions (Connection & conn);
149149
150+ void setOptions () override ;
151+
150152 ConnectionHandle getConnection ();
151153
152154 friend struct ConnectionHandle ;
Original file line number Diff line number Diff line change @@ -724,6 +724,11 @@ public:
724724 virtual void createUser (const std::string & userName, uid_t userId)
725725 { }
726726
727+ /*
728+ * Synchronises the options of the client with those of the daemon
729+ * (a no-op when there’s no daemon)
730+ */
731+ virtual void setOptions () { }
727732protected:
728733
729734 Stats stats;
Original file line number Diff line number Diff line change 1+ source common.sh
2+
3+ clearStore
4+ rm -rf $TEST_HOME /.cache $TEST_HOME /.config $TEST_HOME /.local
5+
6+ cp ./simple.nix ./simple.builder.sh ./config.nix $TEST_HOME
7+
8+ cd $TEST_HOME
9+
10+ rm -f post-hook-ran
11+ cat << EOF > echoing-post-hook.sh
12+ #!/bin/sh
13+
14+ echo "ThePostHookRan" > $PWD /post-hook-ran
15+ EOF
16+ chmod +x echoing-post-hook.sh
17+
18+ cat << EOF > flake.nix
19+ {
20+ nixConfig.post-build-hook = "$PWD /echoing-post-hook.sh";
21+
22+ outputs = a: {
23+ defaultPackage.$system = import ./simple.nix;
24+ };
25+ }
26+ EOF
27+
28+ # Ugly hack for testing
29+ mkdir -p .local/share/nix
30+ cat << EOF > .local/share/nix/trusted-settings.json
31+ {"post-build-hook":{"$PWD /echoing-post-hook.sh":true}}
32+ EOF
33+
34+ nix build
35+ test -f post-hook-ran || fail " The post hook should have ran"
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ nix_tests = \
4646 recursive.sh \
4747 describe-stores.sh \
4848 flakes.sh \
49+ flake-local-settings.sh \
4950 build.sh \
5051 compute-levels.sh \
5152 repl.sh ca/repl.sh \
You can’t perform that action at this time.
0 commit comments