16 lines
376 B
Bash
Executable file
16 lines
376 B
Bash
Executable file
#!/bin/sh
|
|
nh_subcommand="os"
|
|
fallback_command="nixos-rebuild"
|
|
hostname=""
|
|
if [ -n "$1" ]; then
|
|
hostname="#$1"
|
|
fi
|
|
if [ "$(uname -o)" = "darwin" ]; then
|
|
nh_subcommand="darwin"
|
|
fallback_command="nix run .#darwin-rebuild --"
|
|
fi
|
|
if command -v nh >/dev/null; then
|
|
nh $nh_subcommand switch .
|
|
else
|
|
$fallback_command switch --flake '.'"${hostname}"
|
|
fi
|