less junk and ignore logs

This commit is contained in:
2025-06-03 20:08:46 +02:00
parent 986c24ec45
commit 3b7e839d7b
2 changed files with 6 additions and 4 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
# Environment file
.env
# Logs
nixos-switch.log

View File

@ -28,7 +28,6 @@ fi
# Early return if no changes were detected
if git diff --quiet '*.nix'; then
echo "No changes detected, exiting."
popd
exit 0
fi
@ -45,7 +44,7 @@ echo "NixOS Rebuilding configuration for host: $NIXOS_HOST..."
nix flake check
# Rebuild the system
sudo nixos-rebuild switch --flake ./#$NIXOS_HOST &>nixos-switch.log || (cat nixos-switch.log | grep --color error && exit 1)
sudo nixos-rebuild switch --flake ./#$NIXOS_HOST &>logs/nixos-switch.log || (cat logs/nixos-switch.log | grep --color error && exit 1)
# Get current generation metadata
current=$(nixos-rebuild list-generations | grep current)
@ -54,6 +53,6 @@ current=$(nixos-rebuild list-generations | grep current)
git commit -am "$current"
# Clean up old generations older than 180 days
sudo nix-collect-garbage --delete-older-than 180d
sudo nix-collect-garbage --delete-older-than 180d &>logs/nixos-gc.log || (cat logs/nixos-gc.log | grep --color error && exit 1)