diff options
author | Reno Reckling <exi@wthack.de> | 2023-09-30 14:00:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-30 14:00:13 +0200 |
commit | 612035c45f36cc089f0392875c31c7efa2cf608c (patch) | |
tree | 9d42d585d5d86984dd0d757359970f9c40d10091 /nixos/lib/utils.nix | |
parent | 31871e17ce5ad45c9a2127eea826328549006fb2 (diff) | |
download | nixpkgs-612035c45f36cc089f0392875c31c7efa2cf608c.tar nixpkgs-612035c45f36cc089f0392875c31c7efa2cf608c.tar.gz nixpkgs-612035c45f36cc089f0392875c31c7efa2cf608c.tar.bz2 nixpkgs-612035c45f36cc089f0392875c31c7efa2cf608c.tar.lz nixpkgs-612035c45f36cc089f0392875c31c7efa2cf608c.tar.xz nixpkgs-612035c45f36cc089f0392875c31c7efa2cf608c.tar.zst nixpkgs-612035c45f36cc089f0392875c31c7efa2cf608c.zip |
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.
Diffstat (limited to 'nixos/lib/utils.nix')
-rw-r--r-- | nixos/lib/utils.nix | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/nixos/lib/utils.nix b/nixos/lib/utils.nix index 7ea9d6a5c71..e618cf2f861 100644 --- a/nixos/lib/utils.nix +++ b/nixos/lib/utils.nix @@ -177,6 +177,7 @@ rec { genJqSecretsReplacementSnippet' = attr: set: output: let secrets = recursiveGetAttrWithJqPrefix set attr; + stringOrDefault = str: def: if str == "" then def else str; in '' if [[ -h '${output}' ]]; then rm '${output}' @@ -195,10 +196,12 @@ rec { (attrNames secrets)) + "\n" + "${pkgs.jq}/bin/jq >'${output}' " - + lib.escapeShellArg (concatStringsSep - " | " - (imap1 (index: name: ''${name} = $ENV.secret${toString index}'') - (attrNames secrets))) + + lib.escapeShellArg (stringOrDefault + (concatStringsSep + " | " + (imap1 (index: name: ''${name} = $ENV.secret${toString index}'') + (attrNames secrets))) + ".") + '' <<'EOF' ${builtins.toJSON set} |