From fc618fcee0bfcd112ea2cf188c34cf564f1290df Mon Sep 17 00:00:00 2001 From: joy Date: Wed, 3 Jul 2024 15:40:52 +0200 Subject: [PATCH] rb --- home/zsh/default.nix | 3 +-- home/zsh/pc-laptop.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100755 home/zsh/pc-laptop.sh diff --git a/home/zsh/default.nix b/home/zsh/default.nix index b433cdc..c460c93 100644 --- a/home/zsh/default.nix +++ b/home/zsh/default.nix @@ -12,8 +12,7 @@ pu = "git push -u berg main && git push -u hub main"; fr = "sudo systemctl reboot --firmware"; ser = "ssh root@joygnu.org"; - sp = "sudo nixos-rebuild switch --flake ~/nix/#pc"; - sl = "sudo nixos-rebuild switch --flake ~/nix/#laptop"; + rb = "bash ~/nix/home/zsh/pc-laptop.sh"; up = "sudo nix flake update ~/nix"; del = "sudo nix-collect-garbage -d"; gtk = "nvim ~/nix/home/gtk/default.nix"; diff --git a/home/zsh/pc-laptop.sh b/home/zsh/pc-laptop.sh new file mode 100755 index 0000000..4e65379 --- /dev/null +++ b/home/zsh/pc-laptop.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +hostname=$(hostname) + +if [[ $hostname == *"pc"* ]]; then + sudo nixos-rebuild switch --flake ~/nix/#pc +elif [[ $hostname == *"laptop"* ]]; then + sudo nixos-rebuild switch --flake ~/nix/#laptop +else + echo "Unable to determine the type of machine." +fi +