From c4e578e6ce2524b2ba5c45c1ab8b02063fb408f5 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 8 Feb 2024 23:54:12 -0500 Subject: traits/auto-upgrade: init --- modules/nixos/traits/auto-upgrade.nix | 29 +++++++++++++++++++++++++++++ modules/nixos/traits/default.nix | 1 + 2 files changed, 30 insertions(+) create mode 100644 modules/nixos/traits/auto-upgrade.nix (limited to 'modules/nixos') diff --git a/modules/nixos/traits/auto-upgrade.nix b/modules/nixos/traits/auto-upgrade.nix new file mode 100644 index 0000000..bdb919c --- /dev/null +++ b/modules/nixos/traits/auto-upgrade.nix @@ -0,0 +1,29 @@ +{ + config, + lib, + ... +}: let + cfg = config.traits.autoUpgrade; +in { + options.traits.autoUpgrade = { + enable = lib.mkEnableOption "automatic updates"; + }; + + config = lib.mkIf cfg.enable { + system.autoUpgrade = { + enable = true; + + /* + a workflow updates the flake every 24h at ~0:00UTC/8:00EST; + most devices of mine will be in EST currently. this could probably be + "01:00" or "daily" but i think that's a bit of a risk if i ever change/ + dont set the time zone for a device and forget about this lol + */ + dates = lib.mkDefault "02:00"; + flake = "github:getchoo/flake#${config.networking.hostName}"; + flags = [ + "--refresh" + ]; + }; + }; +} diff --git a/modules/nixos/traits/default.nix b/modules/nixos/traits/default.nix index 87bbd46..bf064a2 100644 --- a/modules/nixos/traits/default.nix +++ b/modules/nixos/traits/default.nix @@ -1,6 +1,7 @@ { imports = [ ./acme.nix + ./auto-upgrade.nix ./cloudflared.nix ./containers.nix ./hercules.nix -- cgit v1.2.3