forked from lix-project/lix
Merge pull request #5504 from NixOS/flake-options-and-daemon
Make the flake options work when using the daemon
This commit is contained in:
commit
736d6ab721
|
@ -307,7 +307,7 @@ LockedFlake lockFlake(
|
||||||
|
|
||||||
if (lockFlags.applyNixConfig) {
|
if (lockFlags.applyNixConfig) {
|
||||||
flake.config.apply();
|
flake.config.apply();
|
||||||
// FIXME: send new config to the daemon.
|
state.store->setOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -290,6 +290,10 @@ ConnectionHandle RemoteStore::getConnection()
|
||||||
return ConnectionHandle(connections->get());
|
return ConnectionHandle(connections->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RemoteStore::setOptions()
|
||||||
|
{
|
||||||
|
setOptions(*(getConnection().handle));
|
||||||
|
}
|
||||||
|
|
||||||
bool RemoteStore::isValidPathUncached(const StorePath & path)
|
bool RemoteStore::isValidPathUncached(const StorePath & path)
|
||||||
{
|
{
|
||||||
|
|
|
@ -147,6 +147,8 @@ protected:
|
||||||
|
|
||||||
virtual void setOptions(Connection & conn);
|
virtual void setOptions(Connection & conn);
|
||||||
|
|
||||||
|
void setOptions() override;
|
||||||
|
|
||||||
ConnectionHandle getConnection();
|
ConnectionHandle getConnection();
|
||||||
|
|
||||||
friend struct ConnectionHandle;
|
friend struct ConnectionHandle;
|
||||||
|
|
|
@ -724,6 +724,11 @@ public:
|
||||||
virtual void createUser(const std::string & userName, uid_t userId)
|
virtual void createUser(const std::string & userName, uid_t userId)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Synchronises the options of the client with those of the daemon
|
||||||
|
* (a no-op when there’s no daemon)
|
||||||
|
*/
|
||||||
|
virtual void setOptions() { }
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Stats stats;
|
Stats stats;
|
||||||
|
|
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 \
|
recursive.sh \
|
||||||
describe-stores.sh \
|
describe-stores.sh \
|
||||||
flakes.sh \
|
flakes.sh \
|
||||||
|
flake-local-settings.sh \
|
||||||
build.sh \
|
build.sh \
|
||||||
compute-levels.sh \
|
compute-levels.sh \
|
||||||
repl.sh ca/repl.sh \
|
repl.sh ca/repl.sh \
|
||||||
|
|
Loading…
Reference in a new issue