From f5270d30a9830e40b48ca1e8b40c5532a30b0656 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sat, 20 Apr 2024 15:15:31 +0200 Subject: [PATCH] fixup! refactor: extract function to lib --- lib/config.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/config.nix b/lib/config.nix index c7430b8d..40d81578 100644 --- a/lib/config.nix +++ b/lib/config.nix @@ -49,16 +49,15 @@ in { batchRenameOptions = oldBasePath: newBasePath: mappings: let genSetupOptRenames = oldSubpath: newSubpath: table: mapAttrsToList ( - oldName: newNameOrAttr: - if builtins.isAttrs newNameOrAttr + oldName: newNameOrNestedOpts: + if builtins.isAttrs newNameOrNestedOpts then - genSetupOptRenames (oldSubpath ++ [oldName]) (newSubpath - ++ [newNameOrAttr._name or oldName]) - newNameOrAttr + genSetupOptRenames (oldSubpath ++ [oldName]) (newSubpath ++ [newNameOrNestedOpts._name or oldName]) + (builtins.removeAttrs newNameOrNestedOpts ["_name"]) else mkRenamedOptionModule (oldBasePath ++ oldSubpath ++ [oldName]) - (newBasePath ++ newSubpath ++ [newNameOrAttr]) + (newBasePath ++ newSubpath ++ [newNameOrNestedOpts]) ) table; in