better rb.sh

This commit is contained in:
joygnu 2024-08-31 16:55:57 +02:00
parent 38a204e4f0
commit de3f1f4544
2 changed files with 12 additions and 6 deletions

View file

@ -13,11 +13,11 @@
cat = "bat"; cat = "bat";
cn = "cd ~/nix"; cn = "cd ~/nix";
ls = "${pkgs.eza}/bin/eza --icons -a --group-directories-first"; ls = "${pkgs.eza}/bin/eza --icons -a --group-directories-first";
pu = "sh ~/nix/modules/zsh/scripts/push.sh"; pu = "sh ~/nix/modules/apps/zsh/scripts/push.sh";
ip = "sh ~/nix/modules/zsh/scripts/ip.sh"; ip = "sh ~/nix/modules/apps/zsh/scripts/ip.sh";
fr = "sudo systemctl reboot --firmware"; fr = "sudo systemctl reboot --firmware";
ser = "ssh root@joygnu.org"; ser = "ssh root@joygnu.org";
rb = "sh ~/nix/modules/zsh/scripts/rebuild.sh"; rb = "sh ~/nix/modules/apps/zsh/scripts/rebuild.sh";
up = "sudo nix flake update ~/nix"; up = "sudo nix flake update ~/nix";
del = "sudo nix-collect-garbage -d"; del = "sudo nix-collect-garbage -d";
}; };

View file

@ -1,11 +1,17 @@
#!/bin/sh #!/bin/sh
hostname=$(hostname) current_dir=$(pwd)
cd ~/nix
git add . git add .
if [[ $hostname == *"desktop"* ]]; then hostname=$(hostname)
if echo "$hostname" | grep -q 'desktop'; then
sudo nixos-rebuild switch --flake ~/nix/#desktop sudo nixos-rebuild switch --flake ~/nix/#desktop
elif [[ $hostname == *"laptop"* ]]; then elif echo "$hostname" | grep -q 'laptop'; then
sudo nixos-rebuild switch --flake ~/nix/#laptop sudo nixos-rebuild switch --flake ~/nix/#laptop
fi fi
cd "$current_dir"