zsh: escape double-quoted values

The zsh value renderer emits strings in double quotes so session variables can still expand references such as $HOME. Embedded quotes, backslashes, and backticks were not escaped, which could corrupt generated zsh code or trigger command substitution.

Escape those double-quote-sensitive characters while preserving dollar expansion for existing session-variable semantics.
This commit is contained in:
Austin Horstman
2026-05-18 15:29:56 -05:00
parent 3e17edd5e6
commit c7c139f742
2 changed files with 9 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ rec {
if builtins.isBool v then
if v then "true" else "false"
else if builtins.isString v then
''"${v}"''
''"${lib.escape [ "\\" "\"" "`" ] v}"''
else if builtins.isList v then
let
shell = import ./shell.nix { inherit lib; };