Files
nix-home-manager/scripts/nix-maintain.sh
2026-01-07 19:40:06 +01:00

18 lines
337 B
Bash
Executable File

#!/usr/bin/env bash
set -e
HOST=$(hostname)
FLAKE_PATH="${HOME}/nixConfig"
nix-channel --update
echo "🔁 Rebuilding system for host: $HOST"
sudo nixos-rebuild switch --flake "$FLAKE_PATH#$HOST"
echo "🧹 Collecting garbage..."
sudo nix-collect-garbage --delete-older-than 15d
nix store gc
echo "✅ System rebuilt and cleaned."