You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
infra/modules/auto-update.nix

49 lines
1.1 KiB

{ 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;
};
};
}