diff --git a/nixos-rebuild.sh b/nixos-rebuild.sh
index 54e9e92bb292..9fd29c34ee2c 100755
--- a/nixos-rebuild.sh
+++ b/nixos-rebuild.sh
@@ -254,7 +254,7 @@ nixBuild() {
     logVerbose "Building in legacy (non-flake) mode."
     if [ -z "$buildHost" ]; then
         logVerbose "No --build-host given, running nix-build locally"
-        runCmd nix-build "$@"
+        runCmd @nixBuild@ "$@"
     else
         logVerbose "buildHost set to \"$buildHost\", running nix-build remotely"
         local instArgs=()
@@ -302,10 +302,10 @@ nixFlakeBuild() {
     logVerbose "Building in flake mode."
     if [[ -z "$buildHost" && -z "$targetHost" && "$action" != switch && "$action" != boot && "$action" != test && "$action" != dry-activate ]]
     then
-        runCmd nix "${flakeFlags[@]}" build "$@"
+        runCmd @nixCommand@ build "$@"
         readlink -f ./result
     elif [ -z "$buildHost" ]; then
-        runCmd nix "${flakeFlags[@]}" build "$@" --out-link "${tmpDir}/result"
+        runCmd @nixCommand@ build "$@" --out-link "${tmpDir}/result"
         readlink -f "${tmpDir}/result"
     else
         local attr="$1"
