aboutsummaryrefslogtreecommitdiff
path: root/modules/profiles/upgrade/default.nix
blob: 80fd3e3132abc7220acf46140a26cbb000592157 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{ 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')."
      '';
    };
}