{ config, lib, ... }: { options.athenix = { system.gc = { enable = lib.mkOption { type = lib.types.bool; default = true; description = '' Enable automatic garbage collection of old NixOS generations. Helps keep disk usage under control on long-running systems. ''; }; frequency = lib.mkOption { type = lib.types.str; default = "weekly"; description = '' How often to run garbage collection (systemd timer format). Common values: "daily", "weekly", "monthly" Advanced: "*-*-* 03:00:00" (daily at 3 AM) ''; example = "daily"; }; retentionDays = lib.mkOption { type = lib.types.int; default = 30; description = '' Number of days to keep old system generations before deletion. Older generations allow rolling back system changes. Recommended: 30-90 days for workstations, 7-14 for servers. ''; example = 60; }; optimise = lib.mkOption { type = lib.types.bool; default = true; description = '' Whether to automatically hard-link identical files in the Nix store. Can save significant disk space but uses CPU during optimization. ''; }; }; host.buildMethods = lib.mkOption { type = lib.types.listOf lib.types.str; default = [ "installer-iso" ]; description = '' List of allowed build methods for this host (used by installer/artifacts.nix). Supported methods: - "installer-iso": Generates an auto-install ISO that installs this configuration to disk. - "iso": Generates a live ISO (using nixos-generators). - "ipxe": Generates iPXE netboot artifacts (kernel, initrd, script). - "lxc": Generates an LXC container tarball. - "proxmox": Generates a Proxmox VMA archive. ''; }; }; config = { # Automatic Garbage Collection nix.gc = lib.mkIf config.athenix.system.gc.enable { automatic = true; dates = config.athenix.system.gc.frequency; options = "--delete-older-than ${toString config.athenix.system.gc.retentionDays}d"; }; # Optimize storage nix.optimise.automatic = config.athenix.system.gc.optimise; }; }