nixos-configs/nixosModules/autoupdate.nix

22 lines
483 B
Nix
Raw Normal View History

{ lib, config, ... }:
2025-09-13 15:25:54 +02:00
{
options.my.autoupdate.enable = lib.mkEnableOption "automatic Nix GC and system upgrades";
config = lib.mkIf config.my.autoupdate.enable {
nix = {
optimise.automatic = true;
gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 7d";
};
2025-09-13 15:25:54 +02:00
};
system.autoUpgrade = {
enable = true;
dates = "daily";
# do not forget to set `flake` when using this module!
};
2025-09-13 15:25:54 +02:00
};
}