diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2022-10-09 12:02:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-09 12:02:02 +0000 |
commit | 3e675d06f5f236e84a90ccd4d993d1784d043b4f (patch) | |
tree | c2368cf61f93e08d2adb0394cdf588a632b1e4c1 /nixos/lib | |
parent | ef30dee2d6e0317bbdca083ffc2587e4f0895711 (diff) | |
parent | 8972888c554bd9eafcaf5c17551adc606bba686d (diff) |
Merge staging-next into staging
Diffstat (limited to 'nixos/lib')
-rw-r--r-- | nixos/lib/utils.nix | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/nixos/lib/utils.nix b/nixos/lib/utils.nix index d7671a374999a..f646f70323e35 100644 --- a/nixos/lib/utils.nix +++ b/nixos/lib/utils.nix @@ -102,7 +102,11 @@ rec { if item ? ${attr} then nameValuePair prefix item.${attr} else if isAttrs item then - map (name: recurse (prefix + "." + name) item.${name}) (attrNames item) + map (name: + let + escapedName = ''"${replaceChars [''"'' "\\"] [''\"'' "\\\\"] name}"''; + in + recurse (prefix + "." + escapedName) item.${name}) (attrNames item) else if isList item then imap0 (index: item: recurse (prefix + "[${toString index}]") item) item else @@ -182,13 +186,13 @@ rec { '') (attrNames secrets)) + "\n" - + "${pkgs.jq}/bin/jq >'${output}' '" - + concatStringsSep + + "${pkgs.jq}/bin/jq >'${output}' " + + lib.escapeShellArg (concatStringsSep " | " (imap1 (index: name: ''${name} = $ENV.secret${toString index}'') - (attrNames secrets)) + (attrNames secrets))) + '' - ' <<'EOF' + <<'EOF' ${builtins.toJSON set} EOF (( ! $inherit_errexit_enabled )) && shopt -u inherit_errexit |