aboutsummaryrefslogtreecommitdiff
path: root/modules/profiles/upgrade/default.nix
diff options
context:
space:
mode:
authortdback <tyler@tdback.net>2024-12-21 15:32:13 -0500
committertdback <tyler@tdback.net>2024-12-21 15:32:13 -0500
commit0a5754541bb01e96021ca7ee74f1256a8ee68bc4 (patch)
tree2d0b8089e98239963a1e240cff676b1515fc8431 /modules/profiles/upgrade/default.nix
initial commit to self-hosted git
Diffstat (limited to 'modules/profiles/upgrade/default.nix')
-rw-r--r--modules/profiles/upgrade/default.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/modules/profiles/upgrade/default.nix b/modules/profiles/upgrade/default.nix
new file mode 100644
index 0000000..32c49a8
--- /dev/null
+++ b/modules/profiles/upgrade/default.nix
@@ -0,0 +1,30 @@
+{ inputs, config, ... }:
+{
+ system.autoUpgrade = {
+ enable = true;
+ flake = inputs.self.outPath;
+ flags = [
+ "--update-input"
+ "nixpkgs"
+ "-L"
+ ];
+ dates = "Sat *-*-* 06:00:00";
+ randomizedDelaySec = "45min";
+ allowReboot = true;
+ };
+
+ systemd.services."reboot-alert" =
+ let
+ hostname = config.networking.hostName;
+ dependencies = [ "network-online.target" ];
+ in {
+ wantedBy = [ "multi-user.target" ];
+ wants = dependencies;
+ after = dependencies;
+ serviceConfig.Type = "oneshot";
+ script = ''
+ /run/current-system/sw/bin/pushover -t "${hostname} restarted" \
+ "${hostname} has restarted on $(date '+%a, %b %d at %T %p %Z')."
+ '';
+ };
+}