mirror of
https://github.com/nix-community/home-manager
synced 2025-03-29 09:15:11 +01:00
nix: make sure extra- settings are applied last
All extra- settings should come after their unprefixed counterpart, because the entries of the config file are processed from top to bottom and appending should happen after overwriting. This is a port of https://github.com/NixOS/nixpkgs/pull/278064 .
This commit is contained in:
parent
c7c2517612
commit
e769196105
2 changed files with 13 additions and 5 deletions
|
@ -3,10 +3,11 @@
|
||||||
let
|
let
|
||||||
|
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
boolToString concatStringsSep escape floatToString getVersion isBool
|
boolToString concatStringsSep escape filterAttrs floatToString getVersion
|
||||||
isConvertibleWithToString isDerivation isFloat isInt isList isString
|
hasPrefix isBool isConvertibleWithToString isDerivation isFloat isInt isList
|
||||||
literalExpression maintainers mapAttrsToList mkDefault mkEnableOption mkIf
|
isString literalExpression maintainers mapAttrsToList mkDefault
|
||||||
mkMerge mkOption optionalString toPretty types versionAtLeast;
|
mkEnableOption mkIf mkMerge mkOption optionalString toPretty types
|
||||||
|
versionAtLeast;
|
||||||
|
|
||||||
cfg = config.nix;
|
cfg = config.nix;
|
||||||
|
|
||||||
|
@ -65,13 +66,19 @@ let
|
||||||
mkKeyValuePairs = attrs:
|
mkKeyValuePairs = attrs:
|
||||||
concatStringsSep "\n" (mapAttrsToList mkKeyValue attrs);
|
concatStringsSep "\n" (mapAttrsToList mkKeyValue attrs);
|
||||||
|
|
||||||
|
isExtra = key: hasPrefix "extra-" key;
|
||||||
|
|
||||||
in pkgs.writeTextFile {
|
in pkgs.writeTextFile {
|
||||||
name = "nix.conf";
|
name = "nix.conf";
|
||||||
|
# workaround for https://github.com/NixOS/nix/issues/9487
|
||||||
|
# extra-* settings must come after their non-extra counterpart
|
||||||
text = ''
|
text = ''
|
||||||
# WARNING: this file is generated from the nix.settings option in
|
# WARNING: this file is generated from the nix.settings option in
|
||||||
# your Home Manager configuration at $XDG_CONFIG_HOME/nix/nix.conf.
|
# your Home Manager configuration at $XDG_CONFIG_HOME/nix/nix.conf.
|
||||||
# Do not edit it!
|
# Do not edit it!
|
||||||
${mkKeyValuePairs cfg.settings}
|
${mkKeyValuePairs
|
||||||
|
(filterAttrs (key: value: !(isExtra key)) cfg.settings)}
|
||||||
|
${mkKeyValuePairs (filterAttrs (key: value: isExtra key) cfg.settings)}
|
||||||
${cfg.extraOptions}
|
${cfg.extraOptions}
|
||||||
'';
|
'';
|
||||||
checkPhase =
|
checkPhase =
|
||||||
|
|
|
@ -5,3 +5,4 @@ show-trace = true
|
||||||
system-features = big-parallel kvm recursive-nix
|
system-features = big-parallel kvm recursive-nix
|
||||||
use-sandbox = true
|
use-sandbox = true
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue