diff --git a/hosts/citadel/default.nix b/hosts/citadel/default.nix index b821383..302c580 100644 --- a/hosts/citadel/default.nix +++ b/hosts/citadel/default.nix @@ -91,6 +91,7 @@ in { system.services.nixosAutoUpgrade = { enable = true; persistent = true; + reboot = false; pushUpdates = true; configDir = "/etc/nixos"; onCalendar = "daily"; diff --git a/modules/nixos/nixosAutoUpgrade.nix b/modules/nixos/nixosAutoUpgrade.nix index c0a99e4..8609b7c 100644 --- a/modules/nixos/nixosAutoUpgrade.nix +++ b/modules/nixos/nixosAutoUpgrade.nix @@ -20,6 +20,11 @@ in description = "Extra flags to pass to nixos-rebuild."; default = ""; }; + reboot = lib.mkOption { + type = lib.types.bool; + description = "Automatically reboots the system if there is a kernel or systemd update."; + default = false; + }; onCalendar = lib.mkOption { default = "daily"; type = lib.types.str; @@ -70,6 +75,7 @@ in (lib.mkIf (cfg.configDir != "") "--flake ${cfg.configDir} ").content (lib.mkIf (cfg.user != "") "--user ${cfg.user} ").content (lib.mkIf (cfg.pushUpdates) "--update ").content + (lib.mkIf (cfg.reboot) "--reboot ").content (lib.mkIf (cfg.extraFlags != "") cfg.extraFlags).content ]; };