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";
cn = "cd ~/nix";
ls = "${pkgs.eza}/bin/eza --icons -a --group-directories-first";
pu = "sh ~/nix/modules/zsh/scripts/push.sh";
ip = "sh ~/nix/modules/zsh/scripts/ip.sh";
pu = "sh ~/nix/modules/apps/zsh/scripts/push.sh";
ip = "sh ~/nix/modules/apps/zsh/scripts/ip.sh";
fr = "sudo systemctl reboot --firmware";
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";
del = "sudo nix-collect-garbage -d";
};

View file

@ -1,11 +1,17 @@
#!/bin/sh
hostname=$(hostname)
current_dir=$(pwd)
cd ~/nix
git add .
if [[ $hostname == *"desktop"* ]]; then
hostname=$(hostname)
if echo "$hostname" | grep -q 'desktop'; then
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
fi
cd "$current_dir"