refactor: move GC and buildMethods options to sw module
- Move athenix.system.gc options from fleet/common.nix to sw/gc.nix - Move athenix.host.buildMethods option to sw/gc.nix - Move home-manager, agenix, disko imports to sw/default.nix - Better separation: fleet/ handles generation, sw/ handles software config
This commit is contained in:
@@ -28,8 +28,12 @@ in
|
||||
imports = [
|
||||
./python.nix
|
||||
./ghostty.nix
|
||||
./gc.nix
|
||||
./updater.nix
|
||||
./update-ref.nix
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.agenix.nixosModules.default
|
||||
inputs.disko.nixosModules.disko
|
||||
];
|
||||
|
||||
options.athenix.sw = {
|
||||
|
||||
58
sw/gc.nix
Normal file
58
sw/gc.nix
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.athenix = {
|
||||
system.gc = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Whether to enable automatic garbage collection.";
|
||||
};
|
||||
frequency = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "weekly";
|
||||
description = "How often to run garbage collection (systemd timer format).";
|
||||
};
|
||||
retentionDays = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 30;
|
||||
description = "Number of days to keep old generations before deletion.";
|
||||
};
|
||||
optimise = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Whether to automatically optimize the Nix store.";
|
||||
};
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user