From c644f53ec720e65caff026e410264085bb72071d Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 19 May 2025 13:40:42 +0800 Subject: [PATCH] feat(packages/rebuild): move rebuild script to a package --- homes/x86_64-linux/rafiq/cli.nix | 12 +----------- homes/x86_64-linux/rafiq/cli/zsh.nix | 1 + packages/rebuild/default.nix | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 packages/rebuild/default.nix diff --git a/homes/x86_64-linux/rafiq/cli.nix b/homes/x86_64-linux/rafiq/cli.nix index 6a752af..65a098a 100644 --- a/homes/x86_64-linux/rafiq/cli.nix +++ b/homes/x86_64-linux/rafiq/cli.nix @@ -22,16 +22,6 @@ neovim ripgrep fzf - (pkgs.writeShellScriptBin "rebuild" # sh - '' - if [ ! -f "flake.nix" ]; then - echo "flake.nix not found in current directory. exiting..." - exit 1 - fi - - git add . && \ - nixos-rebuild switch --flake . --use-remote-sudo && \ - git commit -a - '') + pantheon.rebuild ]; } diff --git a/homes/x86_64-linux/rafiq/cli/zsh.nix b/homes/x86_64-linux/rafiq/cli/zsh.nix index d3542cc..e0df0a3 100644 --- a/homes/x86_64-linux/rafiq/cli/zsh.nix +++ b/homes/x86_64-linux/rafiq/cli/zsh.nix @@ -1,5 +1,6 @@ { config, lib, ... }: { + home.sessionVariables.SHELL = "zsh"; programs.zsh = { enable = true; enableVteIntegration = true; diff --git a/packages/rebuild/default.nix b/packages/rebuild/default.nix new file mode 100644 index 0000000..45b84da --- /dev/null +++ b/packages/rebuild/default.nix @@ -0,0 +1,16 @@ +{ lib, pkgs, ... }: +pkgs.writeShellScriptBin "rebuild" # sh +'' +if [ ! -f "flake.nix" ]; then +echo "flake.nix not found in current directory. exiting..." +exit 1 +fi + +git add . && \ +nixos-rebuild switch --flake . --use-remote-sudo && \ +echo "=== opening test shell. ===" && \ +echo "=== exit = commit ===" && \ +echo "=== exit 1 = abort ===" && \ +$SHELL && \ +git commit -a +''