diff options
author | aszlig <aszlig@nix.build> | 2022-08-15 17:04:53 +0200 |
---|---|---|
committer | aszlig <aszlig@nix.build> | 2022-08-15 17:31:45 +0200 |
commit | 362b3ea25da7884152d76c6ffeb100625c31138b (patch) | |
tree | 44f899cc0dcfcff7da584f7c56a1f3dec8990689 /modules/user | |
parent | 22c382665c24682f7e5433ff1f15d2004bf39338 (diff) |
machines + modules: Fix Nix option definitions
Most of the options in nix.conf are now exposed as a submodule with a freeform type and since that change[1] got introduced, we get a bunch of warnings during machine evaluation: trace: warning: The option `nix.useSandbox' defined in `...' has been renamed to `nix.settings.sandbox'. trace: warning: The option `nix.maxJobs' defined in `...' has been renamed to `nix.settings.max-jobs'. trace: warning: The option `nix.buildCores' defined in `...' has been renamed to `nix.settings.cores'. To shut them up, I went through all machines and modules and renamed the remaining options that were not renamed back then when @devhell did some renames in a0297bf921399c3243dcca99626d8697f0735abe. This was done by looking through the output of: $ git grep -A 10 '\<nix\(\.\| *=\)' machines modules After that I tested the contents of the nix.conf of all the machines against the changes this commit introduced via the following command: $ nix-build --no-out-link -E ' with import <nixpkgs/lib>; map (m: m.eval.config.environment.etc."nix/nix.conf".source) (collect (m: m ? eval) (import ./machines)) ' I've sorted the resulting nix.conf files and diffed on that result and the only difference that showed up was the following: allowed-users = * -auto-optimise-store = false auto-optimise-store = true builders-use-substitutes = true cores = 0 This is because the previous way to generate the config was by concatenating strings whereas the new way works on an attribute set, so we get deduplication by design. [1]: https://github.com/NixOS/nixpkgs/pull/139075 Signed-off-by: aszlig <aszlig@nix.build> Cc: @devhell Cc: @Profpatsch Cc: @sternenseemann
Diffstat (limited to 'modules/user')
-rw-r--r-- | modules/user/aszlig/profiles/base.nix | 13 | ||||
-rw-r--r-- | modules/user/aszlig/profiles/managed.nix | 5 | ||||
-rw-r--r-- | modules/user/devhell/profiles/base.nix | 14 |
3 files changed, 12 insertions, 20 deletions
diff --git a/modules/user/aszlig/profiles/base.nix b/modules/user/aszlig/profiles/base.nix index d5e589d1..681a044a 100644 --- a/modules/user/aszlig/profiles/base.nix +++ b/modules/user/aszlig/profiles/base.nix @@ -9,14 +9,11 @@ in { }; config = lib.mkIf cfg.enable { - nix = { - useSandbox = true; - readOnlyStore = true; - buildCores = 0; - extraOptions = '' - auto-optimise-store = true - experimental-features = nix-command flakes - ''; + nix.readOnlyStore = true; + nix.settings = { + sandbox = true; + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; }; users.defaultUserShell = "/var/run/current-system/sw/bin/zsh"; diff --git a/modules/user/aszlig/profiles/managed.nix b/modules/user/aszlig/profiles/managed.nix index dd4bcd58..afb19a2f 100644 --- a/modules/user/aszlig/profiles/managed.nix +++ b/modules/user/aszlig/profiles/managed.nix @@ -88,10 +88,9 @@ in { networking.firewall.enable = false; networking.networkmanager.enable = true; - nix.autoOptimiseStore = true; - nix.buildCores = 0; nix.readOnlyStore = true; - nix.useSandbox = true; + nix.settings.sandbox = true; + nix.settings.auto-optimise-store = true; nixpkgs.config.pulseaudio = true; diff --git a/modules/user/devhell/profiles/base.nix b/modules/user/devhell/profiles/base.nix index 41f5e7cd..e5803fd6 100644 --- a/modules/user/devhell/profiles/base.nix +++ b/modules/user/devhell/profiles/base.nix @@ -14,15 +14,11 @@ in { cleanTmpDir = true; }; - nix = { - settings = { - sandbox = true; - cores = 0; - }; - extraOptions = '' - auto-optimise-store = true - experimental-features = nix-command flakes - ''; + nix.settings = { + sandbox = true; + cores = 0; + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; }; time = { |