summaryrefslogtreecommitdiff
path: root/hosts/ahmed/dyndns
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2025-01-29 10:51:10 +0100
committerLinnnus <[email protected]>2025-01-29 10:59:01 +0100
commit347f032f66125b8e9fea7f5f5de0399aceee8fc0 (patch)
treed191e8aa6561633ae6a0593ebbf69761fa42a357 /hosts/ahmed/dyndns
parent827c6802fc8947ca063d969f6356be75f28e1040 (diff)
ahmed: Factor configuration.nix into smaller submodules
I checked that this didn't result in any (non-trivial) changes like so: $ vi hosts/ahmed/configuration.nix $ nixos-rebuild build --flake .#ahmed $ nix-diff /run/current-system ./result
Diffstat (limited to 'hosts/ahmed/dyndns')
-rw-r--r--hosts/ahmed/dyndns/default.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/hosts/ahmed/dyndns/default.nix b/hosts/ahmed/dyndns/default.nix
new file mode 100644
index 0000000..62c2cca
--- /dev/null
+++ b/hosts/ahmed/dyndns/default.nix
@@ -0,0 +1,20 @@
+# This module sets up dynamic DNS (DDNS).
+#
+# Other services will register the domains to be updated via
+# `services.cloudflare-dyndns.domains`.
+{config, ...}: {
+ services.cloudflare-dyndns = {
+ enable = true;
+ apiTokenFile = config.age.secrets.cloudflare-dyndns-api-token.path;
+ proxied = true;
+ };
+
+ # We have to authenticate the Cloudflare's DDNS service with an API key.
+ age.secrets.cloudflare-dyndns-api-token.file = ../../../secrets/cloudflare-ddns-token.env.age;
+
+ # We also have to overwrite the dependencies of the DYNDNS client service to
+ # make sure we are *actually* online.
+ #
+ # See: https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget
+ systemd.services.cloudflare-dyndns.after = ["network-online.target"];
+}