Fix broken genJqSecretsReplacementSnippet for jq 1.7 (#257932)

jq 1.7 updated it's behaviour and now throws an error
if the first argument is an empty string. It now needs
"." to pass the input through.

authored by

Reno Reckling and committed by
GitHub
612035c4 31871e17

+7 -4
+7 -4
nixos/lib/utils.nix
··· 177 genJqSecretsReplacementSnippet' = attr: set: output: 178 let 179 secrets = recursiveGetAttrWithJqPrefix set attr; 180 in '' 181 if [[ -h '${output}' ]]; then 182 rm '${output}' ··· 195 (attrNames secrets)) 196 + "\n" 197 + "${pkgs.jq}/bin/jq >'${output}' " 198 - + lib.escapeShellArg (concatStringsSep 199 - " | " 200 - (imap1 (index: name: ''${name} = $ENV.secret${toString index}'') 201 - (attrNames secrets))) 202 + '' 203 <<'EOF' 204 ${builtins.toJSON set}
··· 177 genJqSecretsReplacementSnippet' = attr: set: output: 178 let 179 secrets = recursiveGetAttrWithJqPrefix set attr; 180 + stringOrDefault = str: def: if str == "" then def else str; 181 in '' 182 if [[ -h '${output}' ]]; then 183 rm '${output}' ··· 196 (attrNames secrets)) 197 + "\n" 198 + "${pkgs.jq}/bin/jq >'${output}' " 199 + + lib.escapeShellArg (stringOrDefault 200 + (concatStringsSep 201 + " | " 202 + (imap1 (index: name: ''${name} = $ENV.secret${toString index}'') 203 + (attrNames secrets))) 204 + ".") 205 + '' 206 <<'EOF' 207 ${builtins.toJSON set}