about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorGuillaume Girol <symphorien@users.noreply.github.com>2024-03-15 22:46:51 +0100
committerGitHub <noreply@github.com>2024-03-15 22:46:51 +0100
commit1f26e67560d900f10f8b5b6b9e546d2c2fd39977 (patch)
tree483dff2210bd3bc0c5141b21439523bd9a5ecc77 /nixos/modules
parent24025052f8dbb2544f40d9747aa95f01e8ab57ec (diff)
parent5b274d5f017ba4d610e495a6fae8a193966e9d25 (diff)
downloadnixlib-1f26e67560d900f10f8b5b6b9e546d2c2fd39977.tar
nixlib-1f26e67560d900f10f8b5b6b9e546d2c2fd39977.tar.gz
nixlib-1f26e67560d900f10f8b5b6b9e546d2c2fd39977.tar.bz2
nixlib-1f26e67560d900f10f8b5b6b9e546d2c2fd39977.tar.lz
nixlib-1f26e67560d900f10f8b5b6b9e546d2c2fd39977.tar.xz
nixlib-1f26e67560d900f10f8b5b6b9e546d2c2fd39977.tar.zst
nixlib-1f26e67560d900f10f8b5b6b9e546d2c2fd39977.zip
Merge pull request #278064 from symphorien/nix_config_extra
nixos/nix: add workaround for https://github.com/NixOS/nix/issues/9487
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/config/nix.nix9
1 files changed, 8 insertions, 1 deletions
diff --git a/nixos/modules/config/nix.nix b/nixos/modules/config/nix.nix
index e6a74bbb73fc..bce6fd5e5028 100644
--- a/nixos/modules/config/nix.nix
+++ b/nixos/modules/config/nix.nix
@@ -14,8 +14,10 @@ let
     concatStringsSep
     boolToString
     escape
+    filterAttrs
     floatToString
     getVersion
+    hasPrefix
     isBool
     isDerivation
     isFloat
@@ -95,14 +97,19 @@ let
 
       mkKeyValuePairs = attrs: concatStringsSep "\n" (mapAttrsToList mkKeyValue attrs);
 
+      isExtra = key: hasPrefix "extra-" key;
+
     in
     pkgs.writeTextFile {
       name = "nix.conf";
+      # workaround for https://github.com/NixOS/nix/issues/9487
+      # extra-* settings must come after their non-extra counterpart
       text = ''
         # WARNING: this file is generated from the nix.* options in
         # your NixOS configuration, typically
         # /etc/nixos/configuration.nix.  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}
       '';
       checkPhase = lib.optionalString cfg.checkConfig (