diff --git a/nixos/lib/utils.nix b/nixos/lib/utils.nix index 251e0460dd034..35f5853e3f66b 100644 --- a/nixos/lib/utils.nix +++ b/nixos/lib/utils.nix @@ -219,14 +219,14 @@ let let escapedName = ''"${replaceStrings [ ''"'' "\\" ] [ ''\"'' "\\\\" ] name}"''; in - recurse (prefix + "." + escapedName) item.${name} + recurse (prefix + (if prefix == "." then "" else ".") + escapedName) item.${name} ) (attrNames item) else if isList item then imap0 (index: item: recurse (prefix + "[${toString index}]") item) item else [ ]; in - listToAttrs (flatten (recurse "" item)); + listToAttrs (flatten (recurse "." item)); /* Takes an attrset and a file path and generates a bash snippet that