nixos/config/nix: Move legacyConfMappings

This commit is contained in:
Robert Hensing 2023-07-05 12:52:56 +02:00
parent e4558c8ca5
commit 2fa416732c
3 changed files with 44 additions and 16 deletions

View file

@ -0,0 +1,42 @@
/*
Manages /etc/nix.conf, build machines and any nix-specific global config files.
*/
{ config, lib, pkgs, ... }:
let
cfg = config.nix;
inherit (lib)
mapAttrsToList
mkRenamedOptionModuleWith
;
legacyConfMappings = {
useSandbox = "sandbox";
buildCores = "cores";
maxJobs = "max-jobs";
sandboxPaths = "extra-sandbox-paths";
binaryCaches = "substituters";
trustedBinaryCaches = "trusted-substituters";
binaryCachePublicKeys = "trusted-public-keys";
autoOptimiseStore = "auto-optimise-store";
requireSignedBinaryCaches = "require-sigs";
trustedUsers = "trusted-users";
allowedUsers = "allowed-users";
systemFeatures = "system-features";
};
in
{
imports =
mapAttrsToList
(oldConf: newConf:
mkRenamedOptionModuleWith {
sinceRelease = 2205;
from = [ "nix" oldConf ];
to = [ "nix" "settings" newConf ];
})
legacyConfMappings;
}

View file

@ -16,6 +16,7 @@
./config/malloc.nix
./config/mysql.nix
./config/networking.nix
./config/nix.nix
./config/no-x-libs.nix
./config/nsswitch.nix
./config/power-management.nix

View file

@ -77,21 +77,6 @@ let
'');
};
legacyConfMappings = {
useSandbox = "sandbox";
buildCores = "cores";
maxJobs = "max-jobs";
sandboxPaths = "extra-sandbox-paths";
binaryCaches = "substituters";
trustedBinaryCaches = "trusted-substituters";
binaryCachePublicKeys = "trusted-public-keys";
autoOptimiseStore = "auto-optimise-store";
requireSignedBinaryCaches = "require-sigs";
trustedUsers = "trusted-users";
allowedUsers = "allowed-users";
systemFeatures = "system-features";
};
semanticConfType = with types;
let
confAtom = nullOr
@ -117,7 +102,7 @@ in
(mkRenamedOptionModuleWith { sinceRelease = 2205; from = [ "nix" "daemonIONiceLevel" ]; to = [ "nix" "daemonIOSchedPriority" ]; })
(mkRenamedOptionModuleWith { sinceRelease = 2211; from = [ "nix" "readOnlyStore" ]; to = [ "boot" "readOnlyNixStore" ]; })
(mkRemovedOptionModule [ "nix" "daemonNiceLevel" ] "Consider nix.daemonCPUSchedPolicy instead.")
] ++ mapAttrsToList (oldConf: newConf: mkRenamedOptionModuleWith { sinceRelease = 2205; from = [ "nix" oldConf ]; to = [ "nix" "settings" newConf ]; }) legacyConfMappings;
];
###### interface