feat(packages/rebuild): add multi host rebuild to rebuild script
This commit is contained in:
parent
591c90db68
commit
8e12382f60
1 changed files with 10 additions and 2 deletions
|
@ -1,14 +1,22 @@
|
|||
{ pkgs, ... }:
|
||||
pkgs.writeShellScriptBin "rebuild" # sh
|
||||
''
|
||||
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
|
||||
|
||||
git add .
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
for arg in "$@"; do
|
||||
nixos-rebuild switch --flake .#"$arg" --target-host "$arg" --use-remote-sudo
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
CURRENT_GENERATION=$(readlink /nix/var/nix/profiles/system | cut -d- -f2)
|
||||
|
||||
nh os test . || {
|
||||
echo "Error: nixos-rebuild switch failed. Check the output for details."
|
||||
exit 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue