34 lines
No EOL
647 B
Bash
Executable file
34 lines
No EOL
647 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
args=""
|
|
cmd="switch"
|
|
|
|
if [ "$1" == "debug" ]; then
|
|
args="--show-trace -v -L"
|
|
shift
|
|
fi
|
|
|
|
if [ "$1" == "build" ]; then
|
|
cmd="build"
|
|
shift
|
|
fi
|
|
|
|
if [ "$1" == "dry-activate" ]; then
|
|
cmd="dry-activate"
|
|
shift
|
|
fi
|
|
|
|
if [ "$1" == "boot" ]; then
|
|
cmd="boot"
|
|
shift
|
|
fi
|
|
|
|
if [ "$(uname)" == "Darwin" ]; then
|
|
if command -v darwin-rebuild &> /dev/null; then
|
|
darwin-rebuild switch --flake . $args $@
|
|
else
|
|
nix --extra-experimental-features nix-command --extra-experimental-features flakes run nix-darwin -- switch --flake . $args $@
|
|
fi
|
|
else
|
|
sudo nixos-rebuild $cmd --flake . $args $@
|
|
fi |