From 69a2c4cfc86d7faeef25fb08442f29063979cebd Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 16 Jan 2025 17:51:47 +0000 Subject: [PATCH] auto update --- hosts/citadel/default.nix | 1 + modules/nixos/nixosAutoUpgrade.nix | 6 ++++++ 2 files changed, 7 insertions(+) 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 ]; };