rebuild.sh

This commit is contained in:
joygnu 2024-08-10 22:09:09 +02:00
parent bb9383fb0c
commit 074031504a
4 changed files with 24 additions and 13 deletions

View file

@ -17,7 +17,7 @@
pu = "sh ~/nix/home/zsh/push.sh";
fr = "sudo systemctl reboot --firmware";
ser = "ssh root@joygnu.org";
rb = "sh ~/nix/home/zsh/desktop-laptop.sh";
rb = "sh ~/nix/home/zsh/rebuild.sh";
up = "sudo nix flake update ~/nix";
del = "sudo nix-collect-garbage -d";
hy = "hx ~/nix/home/hyprland/default.nix";

View file

@ -1,12 +0,0 @@
#!/bin/sh
hostname=$(hostname)
if [[ $hostname == *"desktop"* ]]; then
sudo nixos-rebuild switch --flake ~/nix/#desktop
elif [[ $hostname == *"laptop"* ]]; then
sudo nixos-rebuild switch --flake ~/nix/#laptop
else
echo "Unable to determine the type of machine."
fi

9
home/zsh/rebuild.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
hostname=$(hostname)
if [[ $hostname == *"desktop"* ]]; then
sudo nixos-rebuild switch --flake ~/nix/#desktop &>nixos-switch.log || (cat nixos-switch.log | grep --color error && false)
elif [[ $hostname == *"laptop"* ]]; then
sudo nixos-rebuild switch --flake ~/nix/#laptop &>nixos-switch.log || (cat nixos-switch.log | grep --color error && false)
fi

14
nixos-switch.log Normal file
View file

@ -0,0 +1,14 @@
warning: Git tree '/home/joy/nix' is dirty
building the system configuration...
warning: Git tree '/home/joy/nix' is dirty
these 5 derivations will be built:
/nix/store/rghppbxs9fqv65yw7rrikahvwm3qn5fm-unit-script-nixos-upgrade-start.drv
/nix/store/c8h4ckzavibas5k78k30v49qjwcv61cq-unit-nixos-upgrade.service.drv
/nix/store/vq8pr1hghqpb0sj3rlp57bm7pgs0g018-system-units.drv
/nix/store/wbp2yaa953qgnxmna3dfr7gw4jl8cxk3-etc.drv
/nix/store/zpc34w2i63yipk2clk0qw5wnzgqnjg02-nixos-system-laptop-24.11.20240804.cb9a96f.drv
building '/nix/store/rghppbxs9fqv65yw7rrikahvwm3qn5fm-unit-script-nixos-upgrade-start.drv'...
building '/nix/store/c8h4ckzavibas5k78k30v49qjwcv61cq-unit-nixos-upgrade.service.drv'...
building '/nix/store/vq8pr1hghqpb0sj3rlp57bm7pgs0g018-system-units.drv'...
building '/nix/store/wbp2yaa953qgnxmna3dfr7gw4jl8cxk3-etc.drv'...
error: interrupted by the user