nix/modules/programs/home/zsh/scripts/rebuild.sh
2024-10-15 20:13:25 +02:00

24 lines
496 B
Bash
Executable file

#!/bin/sh
current_dir=$(pwd)
cd ~/nix
git add .
alejandra .
hostname=$(hostname)
if echo "$hostname" | grep -q 'desktop'; then
doas nixos-rebuild switch --flake ~/nix/#desktop
elif echo "$hostname" | grep -q 'laptop'; then
doas nixos-rebuild switch --flake ~/nix/#laptop
elif echo "$hostname" | grep -q 'server'; then
doas nixos-rebuild switch --flake ~/nix/#server
elif echo "$hostname" | grep -q 'localhost'; then
nix-on-droid switch --flake ~/nix
fi
cd "$current_dir"