From 1a7959808ac18f10948bc1e5916b488855ed15d6 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Wed, 5 Jun 2024 16:39:29 +0100 Subject: [PATCH] Replace zsh update aliases with system-update-all script --- programs/shell/default.nix | 4 ---- scripts/default.nix | 2 ++ scripts/shell/system-update-all.sh | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 scripts/shell/system-update-all.sh diff --git a/programs/shell/default.nix b/programs/shell/default.nix index dbf715d..8470d1b 100644 --- a/programs/shell/default.nix +++ b/programs/shell/default.nix @@ -70,10 +70,6 @@ "EDITOR" = "emacs -nw"; "VISUAL" = "emacs"; }; - shellAliases = { - nixos-switch = "sudo nixos-rebuild switch --flake flake:my-nixos --show-trace"; - home-manager-switch = "nix run flake:my-home-manager -- switch --flake flake:my-home-manager --show-trace"; - }; initExtra = '' ## completion config and styling zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' diff --git a/scripts/default.nix b/scripts/default.nix index 2a53469..d0ec350 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -1,5 +1,7 @@ {pkgs, ...}: { home.packages = [ + (pkgs.writeShellScriptBin "system-update-all" + (builtins.readFile ./shell/system-update-all.sh)) (pkgs.writeShellScriptBin "git-sync-all" (builtins.readFile ./shell/git-sync-all.sh)) (pkgs.writeShellScriptBin "rsync-local-config" diff --git a/scripts/shell/system-update-all.sh b/scripts/shell/system-update-all.sh new file mode 100644 index 0000000..fac7392 --- /dev/null +++ b/scripts/shell/system-update-all.sh @@ -0,0 +1,14 @@ +NIXOS_CONFIGURATION="/etc/nixos" +HOME_MANAGER_CONFIGURATION="$HOME/.config/home-manager" + +( + cd "$NIXOS_CONFIGURATION" || exit 1 + git pull --ff --ff-only || exit 1 + sudo nixos-rebuild switch +) + +( + cd "$HOME_MANAGER_CONFIGURATION" || exit 1 + git pull --ff --ff-only || exit 1 + home-manager switch +)