parent
bf4c33042d
commit
e26d4dd255
@ -0,0 +1,49 @@ |
||||
{ config, lib, pkgs, ... }: |
||||
|
||||
with lib; |
||||
|
||||
let |
||||
cfg = config.infra.autoUpdate; |
||||
in { |
||||
options.infra.autoUpdate = { |
||||
enable = mkEnableOption "automatic system upgrades"; |
||||
|
||||
flake = mkOption { |
||||
type = types.nullOr types.str; |
||||
default = null; |
||||
description = "Flake URI to build from"; |
||||
}; |
||||
|
||||
flags = mkOption { |
||||
type = types.listOf types.str; |
||||
default = [ "--commit-lock-file" ]; |
||||
description = "Extra flags passed to nix flake update"; |
||||
}; |
||||
|
||||
dates = mkOption { |
||||
type = types.str; |
||||
default = "04:00"; |
||||
description = "Schedule for the upgrade"; |
||||
}; |
||||
|
||||
allowReboot = mkOption { |
||||
type = types.bool; |
||||
default = false; |
||||
description = "Reboot the system after an upgrade if needed"; |
||||
}; |
||||
|
||||
randomizedDelaySec = mkOption { |
||||
type = types.str; |
||||
default = "45min"; |
||||
description = "Randomized delay added to the schedule"; |
||||
}; |
||||
}; |
||||
|
||||
config = mkIf cfg.enable { |
||||
system.autoUpgrade = { |
||||
enable = true; |
||||
inherit (cfg) dates flags allowReboot randomizedDelaySec; |
||||
flake = cfg.flake; |
||||
}; |
||||
}; |
||||
} |
||||
Loading…
Reference in new issue