diff --git a/lib/attrsets.nix b/lib/attrsets.nix index 4518a94b6745..fc6bf84415b8 100644 --- a/lib/attrsets.nix +++ b/lib/attrsets.nix @@ -1042,7 +1042,7 @@ rec { ::: */ - mapAttrs' = f: set: listToAttrs (map (attr: f attr set.${attr}) (attrNames set)); + mapAttrs' = f: set: listToAttrs (mapAttrsToList f set); /** Call a function for each attribute in the given set and return @@ -1076,7 +1076,7 @@ rec { ::: */ - mapAttrsToList = f: attrs: map (name: f name attrs.${name}) (attrNames attrs); + mapAttrsToList = f: attrs: attrValues (mapAttrs f attrs); /** Deconstruct an attrset to a list of name-value pairs as expected by [`builtins.listToAttrs`](https://nixos.org/manual/nix/stable/language/builtins.html#builtins-listToAttrs). diff --git a/nixos/modules/services/networking/strongswan-swanctl/param-lib.nix b/nixos/modules/services/networking/strongswan-swanctl/param-lib.nix index 1619cb6cf089..b8a46d5150bc 100644 --- a/nixos/modules/services/networking/strongswan-swanctl/param-lib.nix +++ b/nixos/modules/services/networking/strongswan-swanctl/param-lib.nix @@ -89,7 +89,7 @@ rec { in recurse [ ] set; - mapAttrs'' = f: set: foldl' (a: b: a // b) { } (map (attr: f attr set.${attr}) (attrNames set)); + mapAttrs'' = f: set: foldl' (a: b: a // b) { } (mapAttrsToList f set); # Extract the options from the given set of parameters. paramsToOptions = ps: mapParamsRecursive (_path: name: param: { ${name} = param.option; }) ps;