diff --git a/modules/installer/tools/nixos-rebuild.sh b/modules/installer/tools/nixos-rebuild.sh
index 5c1faf7eb4f..8d87b59bfb2 100644
--- a/modules/installer/tools/nixos-rebuild.sh
+++ b/modules/installer/tools/nixos-rebuild.sh
@@ -119,7 +119,7 @@ trap 'rm -rf "$tmpDir"' EXIT
 # This matters if the new Nix in Nixpkgs has a schema change.  It
 # would upgrade the schema, which should only happen once we actually
 # switch to the new configuration.
-if initctl status nix-daemon 2>&1 | grep -q ' running'; then
+if initctl status nix-daemon 2>&1 | grep -q 'running'; then
     export NIX_REMOTE=${NIX_REMOTE:-daemon}
 fi