57 lines
1.1 KiB
Nix
57 lines
1.1 KiB
Nix
{ 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 = false;
|
|
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;
|
|
options = "--delete-older-than 2d";
|
|
};
|
|
};
|
|
|
|
};
|
|
}
|