-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathduckdns.nix
33 lines (31 loc) · 834 Bytes
/
duckdns.nix
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
32
33
{ config, pkgs, ... }:
let
script = config.sops.secrets.duckdns.path;
in {
systemd.timers.duckdns = {
description = "Updates dynamic DNS every 10 minutes";
wantedBy = [ "timers.target" ];
timerConfig = {
Unit = "duckdns.service";
OnCalendar = "*-*-* *:0/10:00";
Persistent = true;
};
};
systemd.services.duckdns = {
description = "Updates dynamic DNS.";
after = [ "network-online.target" ];
wants = [ "duckdns.timer" "network-online.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = script;
User = config.users.users.duckdns.name;
Environment="PATH=${pkgs.curl}/bin/";
};
};
users.users.duckdns = {
description = "User for dynamic DNS renewal.";
isSystemUser = true;
group = "duckdns";
};
users.groups.duckdns = {};
}