summaryrefslogtreecommitdiff
path: root/modules/nixos/traits
diff options
context:
space:
mode:
authorseth <[email protected]>2024-02-08 23:54:12 -0500
committerseth <[email protected]>2024-02-09 01:17:16 -0500
commitc4e578e6ce2524b2ba5c45c1ab8b02063fb408f5 (patch)
treecbba07e59304bd6f594935c777a05734fca4ba36 /modules/nixos/traits
parent36fc22ff3d454fd53094aaa5c22ed8bb365bc327 (diff)
traits/auto-upgrade: init
Diffstat (limited to 'modules/nixos/traits')
-rw-r--r--modules/nixos/traits/auto-upgrade.nix29
-rw-r--r--modules/nixos/traits/default.nix1
2 files changed, 30 insertions, 0 deletions
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