From c4bfbd8926f7a0fb03b5765381b22e4c02556871 Mon Sep 17 00:00:00 2001 From: Sizhe Zhao Date: Sat, 16 Aug 2025 16:00:19 +0800 Subject: [PATCH] recursiveGetAttrsetWithJqPrefix: fix top level values Co-authored-by: linyinfeng --- nixos/lib/utils.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/lib/utils.nix b/nixos/lib/utils.nix index 251e0460dd03..35f5853e3f66 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