diff options
author | Azat Bahawi <azat@bahawi.net> | 2023-12-03 02:52:28 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2023-12-03 02:52:28 +0300 |
commit | cec9f7acd5e5e365563212c5144394f71dd90b27 (patch) | |
tree | 667b308a7241ab2e8f3fa4e2b53cc7888e876c68 /packages | |
parent | 2023-11-29 (diff) |
2023-12-03
Diffstat (limited to '')
-rw-r--r-- | packages/nixfiles.nix | 10 |
1 files changed, 8 insertions, 2 deletions
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 ''; |