summary refs log tree commit diff
path: root/nixos/modules/rename.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-01-22 14:02:47 +0100
committeraszlig <aszlig@redmoonstudios.org>2015-01-22 14:08:28 +0100
commit127c928c2372a65924830d2db1e74296e351dca5 (patch)
tree5461b6b181f35776da0eb1901728d751622cfe0b /nixos/modules/rename.nix
parentc5692758b536bc5e5a54db544e8d802454b72482 (diff)
downloadnixlib-127c928c2372a65924830d2db1e74296e351dca5.tar
nixlib-127c928c2372a65924830d2db1e74296e351dca5.tar.gz
nixlib-127c928c2372a65924830d2db1e74296e351dca5.tar.bz2
nixlib-127c928c2372a65924830d2db1e74296e351dca5.tar.lz
nixlib-127c928c2372a65924830d2db1e74296e351dca5.tar.xz
nixlib-127c928c2372a65924830d2db1e74296e351dca5.tar.zst
nixlib-127c928c2372a65924830d2db1e74296e351dca5.zip
nixos/rename: Fix merging multiple destinations.
The renaming of options define the original value for the new attribute
path. This works well if there is only *one* target, but if there are
more, we end up recursing into the attribute set of the option
definition itself.

We now check for that within the parent recursion node (we can't check
that from the subnode, because we lack that information about whether
it's defined multiple times) and if the subnode consist entirely of a
list of definitions, we use mkMerge on it.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'nixos/modules/rename.nix')
-rw-r--r--nixos/modules/rename.nix7
1 files changed, 4 insertions, 3 deletions
diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix
index 20fd76855d96..1efc278aeb22 100644
--- a/nixos/modules/rename.nix
+++ b/nixos/modules/rename.nix
@@ -33,7 +33,8 @@ let
   zipModules = list:
     zipAttrsWith (n: v:
       if tail v != [] then
-        if n == "_type" then (head v)
+        if all (o: isAttrs o && o ? _type) v then mkMerge v
+        else if n == "_type" then head v
         else if n == "warnings" then concatLists v
         else if n == "description" || n == "apply" then
           abort "Cannot rename an option to multiple options."
@@ -115,8 +116,8 @@ in zipModules ([]
 ++ obsolete [ "nix" "proxy" ] [ "networking" "proxy" "default" ]
 
 # KDE
-++ deprecated [ "kde" "extraPackages" ] [ "environment" "kdePackages" ]
-# ++ obsolete [ "environment" "kdePackages" ] [ "environment" "systemPackages" ] # !!! doesn't work!
+++ deprecated [ "kde" "extraPackages" ] [ "environment" "systemPackages" ]
+++ obsolete [ "environment" "kdePackages" ] [ "environment" "systemPackages" ]
 
 # Multiple efi bootloaders now
 ++ obsolete [ "boot" "loader" "efi" "efibootmgr" "enable" ] [ "boot" "loader" "efi" "canTouchEfiVariables" ]