Configure nix settings (#257)

Only manage /etc/nix/nix.conf options based on nixpkgs options.
We cannot control nix-gc / nix-daemon services yet as they rely on users.
This commit is contained in:
Jean-François Roche 2025-08-21 00:24:02 +02:00 committed by GitHub
parent ba09b781b1
commit 3219a927e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 42 additions and 1 deletions

View file

@ -134,6 +134,16 @@ let
'';
};
};
nix = {
settings = {
experimental-features = [
"nix-command"
"flakes"
];
trusted-users = [ "zimbatm" ];
};
};
};
}
)
@ -149,7 +159,7 @@ forEachUbuntuImage "example" {
];
extraPathsToRegister = [ newConfig ];
testScriptFunction =
{ toplevel, ... }:
{ toplevel, hostPkgs, ... }:
#python
''
# Start all machines in parallel
@ -223,6 +233,9 @@ forEachUbuntuImage "example" {
vm.fail("test -f /etc/baz/bar/foo2")
vm.succeed("test -f /etc/foo_new")
nix_trusted_users = vm.succeed("${hostPkgs.nix}/bin/nix config show trusted-users").strip()
assert "zimbatm" in nix_trusted_users, f"Expected 'zimbatm' to be in trusted-users, got {nix_trusted_users}"
${system-manager.lib.deactivateProfileSnippet {
node = "vm";
profile = newConfig;