{ config, lib, ... }: let cfg = config.my.utils.commons; in { options.my.utils.commons = { enable = lib.mkEnableOption "Enable commons stuff that are always nice to have"; autoupgrade = { enable = lib.mkEnableOption "Enable auto upgrade"; allowReboot = lib.mkOption { default = false; type = lib.types.bool; description = config.system.autoUpgrade.allowReboot; }; }; gc = { enable = lib.mkOption { default = true; type = lib.types.bool; description = "Enable garbage collection"; }; }; }; config = lib.mkIf cfg.enable { time.timeZone = "Europe/Rome"; # Auto update system.autoUpgrade = lib.mkIf cfg.autoupgrade.enable { enable = true; randomizedDelaySec = "10min"; allowReboot = cfg.autoupgrade.allowReboot; }; nix = { settings.experimental-features = [ "nix-command" "flakes" ]; gc = lib.mkIf cfg.gc.enable { # Auto delete old generations automatic = true; dates = "daily"; options = "--delete-older-than 2d"; }; }; }; }