File tree Expand file tree Collapse file tree 3 files changed +42
-1
lines changed
nix/modules/upstream/nixpkgs Expand file tree Collapse file tree 3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 77 imports =
88 [
99 ./nginx.nix
10+ ./nix.nix
1011 ]
1112 ++
1213 # List of imported NixOS modules
1516 "/misc/meta.nix"
1617 "/security/acme/"
1718 "/services/web-servers/nginx/"
19+ # nix settings
20+ "/config/nix.nix"
1821 ] ;
1922
2023 options =
Original file line number Diff line number Diff line change 1+ { lib , pkgs , ... } :
2+ {
3+ options = {
4+ # options coming from modules/services/system/nix-daemon.nix that we cannot import just yet because it
5+ # depends on users. These are the minimum options we need to be able to configure Nix using system-manager.
6+ nix = {
7+ enable = lib . mkOption {
8+ type = lib . types . bool ;
9+ default = true ;
10+ description = ''
11+ Whether to enable Nix.
12+ Disabling Nix makes the system hard to modify and the Nix programs and configuration will not be made available by NixOS itself.
13+ '' ;
14+ } ;
15+ package = lib . mkOption {
16+ type = lib . types . package ;
17+ default = pkgs . nix ;
18+ defaultText = lib . literalExpression "pkgs.nix" ;
19+ description = ''
20+ This option specifies the Nix package instance to use throughout the system.
21+ '' ;
22+ } ;
23+ } ;
24+ } ;
25+ }
Original file line number Diff line number Diff line change 134134 '' ;
135135 } ;
136136 } ;
137+
138+ nix = {
139+ settings = {
140+ experimental-features = [
141+ "nix-command"
142+ "flakes"
143+ ] ;
144+ trusted-users = [ "zimbatm" ] ;
145+ } ;
146+ } ;
137147 } ;
138148 }
139149 )
@@ -149,7 +159,7 @@ forEachUbuntuImage "example" {
149159 ] ;
150160 extraPathsToRegister = [ newConfig ] ;
151161 testScriptFunction =
152- { toplevel , ... } :
162+ { toplevel , hostPkgs , ... } :
153163 #python
154164 ''
155165 # Start all machines in parallel
@@ -223,6 +233,9 @@ forEachUbuntuImage "example" {
223233 vm.fail("test -f /etc/baz/bar/foo2")
224234 vm.succeed("test -f /etc/foo_new")
225235
236+ nix_trusted_users = vm.succeed("${ hostPkgs . nix } /bin/nix config show trusted-users").strip()
237+ assert "zimbatm" in nix_trusted_users, f"Expected 'zimbatm' to be in trusted-users, got {nix_trusted_users}"
238+
226239 ${ system-manager . lib . deactivateProfileSnippet {
227240 node = "vm" ;
228241 profile = newConfig ;
You can’t perform that action at this time.
0 commit comments