From c8a0ec5580d8ac61d50b987ae2a6a3bdc271f57b Mon Sep 17 00:00:00 2001 From: death916 Date: Wed, 16 Jul 2025 02:53:17 -0700 Subject: [PATCH] nh-push snapshot first --- scripts/nh-push | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/nh-push b/scripts/nh-push index ca80ae2..e70cd6b 100755 --- a/scripts/nh-push +++ b/scripts/nh-push @@ -15,6 +15,14 @@ echo "Pulling latest changes from git..." # Use -C to specify the repository path for git operations. git -C "$REPO_ROOT" pull +# --- Snapshot Creation (Laptop only) --- +if [ "$(hostname)" = "nixos" ]; then + echo "Creating Btrfs snapshots for /nix and /home..." + sudo btrfs subvolume snapshot -r /nix "/snapshots/nix_$(date +%Y-%m-%d_%H%M)" + sudo btrfs subvolume snapshot -r /home "/snapshots/home_$(date +%Y-%m-%d_%H%M)" + echo "Snapshots created." +fi + # --- NixOS Build --- echo "Building NixOS configuration..." # Use --flake to specify the flake path.