feat(packages/rebuild): move rebuild script to a package

This commit is contained in:
Mohammad Rafiq 2025-05-19 13:40:42 +08:00
parent d13962a7d9
commit c644f53ec7
No known key found for this signature in database
3 changed files with 18 additions and 11 deletions

View file

@ -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
''