From 6def5b9948e0d3cdf53cb864308ce725b81d38e9 Mon Sep 17 00:00:00 2001 From: joy Date: Sat, 10 Aug 2024 22:09:09 +0200 Subject: [PATCH] rebuild.sh --- home/zsh/default.nix | 2 +- home/zsh/desktop-laptop.sh | 12 ------------ home/zsh/rebuild.sh | 9 +++++++++ nixos-switch.log | 14 ++++++++++++++ 4 files changed, 24 insertions(+), 13 deletions(-) delete mode 100755 home/zsh/desktop-laptop.sh create mode 100755 home/zsh/rebuild.sh create mode 100644 nixos-switch.log diff --git a/home/zsh/default.nix b/home/zsh/default.nix index c6faaef..67a2511 100644 --- a/home/zsh/default.nix +++ b/home/zsh/default.nix @@ -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"; diff --git a/home/zsh/desktop-laptop.sh b/home/zsh/desktop-laptop.sh deleted file mode 100755 index aca5216..0000000 --- a/home/zsh/desktop-laptop.sh +++ /dev/null @@ -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 - diff --git a/home/zsh/rebuild.sh b/home/zsh/rebuild.sh new file mode 100755 index 0000000..66d47e0 --- /dev/null +++ b/home/zsh/rebuild.sh @@ -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 diff --git a/nixos-switch.log b/nixos-switch.log new file mode 100644 index 0000000..aa4a074 --- /dev/null +++ b/nixos-switch.log @@ -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