Proper nix.extraConfig support. Must usptream that.

This commit is contained in:
Antoine Viallon 2022-01-22 20:36:47 +01:00
parent 4319f5a3cc
commit 6d390e7292
Signed by: aviallon
GPG key ID: 186FC35EDEB25716

View file

@ -2,6 +2,18 @@
with lib;
let
cfg = config.aviallon.general;
nixConfigValue = value:
if value == true then "true"
else if value == false then "false"
else if isList value then (toString value)
else generators.mkValueStringDefault { } value;
nixConfig = settings: (generators.toKeyValue {
listsAsDuplicateKeys = false;
mkKeyValue = generators.mkKeyValueDefault {
mkValueString = nixConfigValue;
} " = ";
} settings);
in
{
options.aviallon.general = {
@ -84,9 +96,11 @@ in
];
nix.distributedBuilds = mkDefault false;
nix.extraOptions = ''
builders-use-substitutes = true
'';
nix.package = (if (builtins.compareVersions pkgs.nix.version "2.4" >= 0) then pkgs.nix else pkgs.nix_2_4);
nix.extraOptions = nixConfig {
builders-use-substitutes = true;
experimental-features = [ "nix-command" "flakes" ];
};
};
}