automated garbage collection
All checks were successful
Apply Kuberentes Configs / update-repo (push) Successful in 0s
Apply Kuberentes Configs / update-infrastructure (push) Successful in 1s
Apply Kuberentes Configs / notify-on-failure (push) Has been skipped

This commit is contained in:
2026-02-18 21:00:32 -07:00
parent b64dd151ff
commit f72966f229
2 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
name: Cleanup NixOS Generations
on:
schedule:
- cron: '0 2 * * 0' # Every Sunday at 2am
workflow_dispatch:
jobs:
cleanup-generations:
runs-on: [home-server]
steps:
- name: Cleanup old NixOS generations
run: |
echo "Deleting generations older than 7 days..."
sudo nix-collect-garbage --delete-older-than 7d
notify-on-failure:
runs-on: home-server
needs: cleanup-generations
if: failure()
uses: ./.gitea/workflows/notify-ntfy.yml
secrets:
NTFY_CHANNEL: ${{ secrets.NTFY_CHANNEL }}
with:
title: "NixOS Cleanup Failed"
message: |
Failed to cleanup old NixOS generations
Workflow: ${{ gitea.workflow }}
Repository: ${{ gitea.repository }}
Job: cleanup-generations
Status: ${{ needs.cleanup-generations.result }}
action_url: "https://git.alexmickelson.guru/${{ gitea.repository }}/actions/runs/${{ gitea.run_number }}"
priority: "high"
tags: "rotating_light,nixos"

View File

@@ -54,6 +54,18 @@
users.groups.gitea-runner = { }; users.groups.gitea-runner = { };
security.sudo.extraRules = [
{
users = [ "gitea-runner" ];
commands = [
{
command = "${pkgs.nix}/bin/nix-collect-garbage";
options = [ "NOPASSWD" ];
}
];
}
];
system.activationScripts.zfs-delegate-gitea-runner = { system.activationScripts.zfs-delegate-gitea-runner = {
text = text =
let let