From 36bd2b4e780004f5556b3629c295dcb404337074 Mon Sep 17 00:00:00 2001 From: naturallaw777 Date: Fri, 16 Oct 2026 17:37:55 +0000 Subject: [PATCH] password-model.nix: fix Nix string escaping in the generate fallback The word-picking one-liner used `eval echo \${...}`, but in a Nix indented string a backslash does not escape `${` -- it starts interpolation, so evaluation failed with "syntax error, unexpected invalid token". Replace the eval/positional-parameter trick with a plain `shuf` pipeline that contains no `${` at all. Found by nixos-rebuild boot on staging-dev. The shell logic itself was tested; the file had not been parse-checked by Nix. Re-scanned the whole module: every remaining `${` is an intended interpolation and every `''` is a string delimiter. --- modules/password-model.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/password-model.nix b/modules/password-model.nix index bf93625..8391e1a 100644 --- a/modules/password-model.nix +++ b/modules/password-model.nix @@ -61,7 +61,7 @@ let pixel plum pond prism quartz raven ridge river robin rocky rose rowan sage sand sierra silver slate snow solar spark spruce stone storm summit swift thorn tide timber torch trout vale vault vine walnut wave willow wren" - pw=$(for i in 1 2 3 4; do set -- $W; eval echo \${$((RANDOM % $# + 1))}; done | paste -sd- -)-$(printf '%02d' $((RANDOM % 100))) + pw=$(echo $W | tr ' ' '\n' | shuf -n4 | paste -sd- -)-$(printf '%02d' $((RANDOM % 100))) umask 077; printf '%s\n' "$pw" > "$f" echo "${account}:$pw" | chpasswd ''}