diff --git a/home.nix b/home.nix index 81b9674..3968a1f 100644 --- a/home.nix +++ b/home.nix @@ -312,16 +312,9 @@ in fi # Ensure global config uses Pi (idempotent - only writes if missing or still `agent: auto`) cfg="$HOME/.no-mistakes/config.yaml" - if [ -f "$cfg" ] && grep -qE '^\s*agent:\s*auto\s*$' "$cfg"; then + if [ -f "$cfg" ] && grep -qE '^[[:space:]]*agent:[[:space:]]*auto[[:space:]]*$' "$cfg"; then tmp="$(mktemp)" - awk ' - /^\s*agent:\s*auto\s*$/ { - print "# Managed by dotfiles/home.nix home.activation.noMistakes"; - print "agent: [pi]"; - next - } - { print } - ' "$cfg" > "$tmp" && mv "$tmp" "$cfg" + sed 's|^[[:space:]]*agent:[[:space:]]*auto[[:space:]]*$|# Managed by dotfiles/home.nix home.activation.noMistakes\nagent: [pi]|' "$cfg" > "$tmp" && mv "$tmp" "$cfg" fi if [ ! -f "$cfg" ]; then mkdir -p "$(dirname "$cfg")"