fix(rebuild): use nh os switch instead of nixos-rebuild switch for remote hosts
This commit is contained in:
parent
71b3703c75
commit
8f493b68b0
1 changed files with 8 additions and 9 deletions
|
@ -13,21 +13,21 @@ pkgs.writeShellScriptBin "rebuild" # sh
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ ! -f "flake.nix" ]; then
|
|
||||||
echo "Error: flake.nix not found in the current directory. Exiting."
|
|
||||||
exit 1 # Indicate an error
|
|
||||||
fi
|
|
||||||
#TODO: get hostnames from flake nixosConfigurations
|
|
||||||
|
|
||||||
QUICK=false
|
QUICK=false
|
||||||
NO_GENERATION_CHECK=false
|
NO_GENERATION_CHECK=false
|
||||||
TEST_SHELL=false
|
TEST_SHELL=false
|
||||||
REMOTE_HOSTS=()
|
REMOTE_HOSTS=()
|
||||||
ALL_HOSTS=("nemesis" "mellinoe" "apollo")
|
ALL_HOSTS=("nemesis" "mellinoe" "apollo")
|
||||||
REBUILDING_ALL=false
|
REBUILDING_ALL=false
|
||||||
|
|
||||||
CURRENT_GENERATION=$(readlink /nix/var/nix/profiles/system | cut -d- -f2)
|
CURRENT_GENERATION=$(readlink /nix/var/nix/profiles/system | cut -d- -f2)
|
||||||
|
|
||||||
|
if [ ! -f "flake.nix" ]; then
|
||||||
|
echo "Error: flake.nix not found in the current directory. Exiting."
|
||||||
|
exit 1 # Indicate an error
|
||||||
|
fi
|
||||||
|
|
||||||
|
#TODO: get hostnames from flake nixosConfigurations
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--quick | -q)
|
--quick | -q)
|
||||||
|
@ -67,8 +67,7 @@ pkgs.writeShellScriptBin "rebuild" # sh
|
||||||
if [ ''${#REMOTE_HOSTS[@]} -gt 0 ]; then
|
if [ ''${#REMOTE_HOSTS[@]} -gt 0 ]; then
|
||||||
for host in "''${REMOTE_HOSTS[@]}"; do
|
for host in "''${REMOTE_HOSTS[@]}"; do
|
||||||
echo "Rebuilding $host..."
|
echo "Rebuilding $host..."
|
||||||
nixos-rebuild switch --flake .#"$host" --target-host "$host" --use-remote-sudo || {
|
nh os switch .#nixosConfigurations."$host" --target-host "$host" || {
|
||||||
echo "Error: nixos-rebuild switch failed for $host. Check the output."
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue