From cec9f7acd5e5e365563212c5144394f71dd90b27 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 3 Dec 2023 02:52:28 +0300 Subject: 2023-12-03 --- packages/nixfiles.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'packages/nixfiles.nix') diff --git a/packages/nixfiles.nix b/packages/nixfiles.nix index 02e89f2..bfc869a 100644 --- a/packages/nixfiles.nix +++ b/packages/nixfiles.nix @@ -26,6 +26,12 @@ # Hopefully Naïm will not sue me for copyright infrigment. text = '' nixfiles="''${NIXFILES:-.}" + rebuild="nixos-rebuild" + rebuild_opts=(--fast --use-remote-sudo) + if [[ "$(uname)" == Darwin ]]; then + rebuild="darwin-rebuild" + rebuild_opts=() + fi cmd=$1 shift case $cmd in @@ -108,10 +114,10 @@ # Assumes that hosts are configured in the OpenSSH configuration. host=''${cmd#@} hostname=$(ssh -q "$host" 'echo "$HOSTNAME"') - exec nixos-rebuild -v --flake "$nixfiles#$hostname" --target-host "$host" --use-remote-sudo --show-trace "$@" + exec "$rebuild" -v --flake "$nixfiles#$hostname" --target-host "$host" "''${rebuild_opts[@]}" --show-trace "$@" ;; *) - exec nixos-rebuild -v --fast --flake "$nixfiles" --use-remote-sudo --show-trace "$cmd" "$@" + exec "$rebuild" -v --flake "$nixfiles" "''${rebuild_opts[@]}" --show-trace "$cmd" "$@" ;; esac ''; -- cgit v1.2.3