about summary refs log tree commit diff
path: root/nixos/modules/services/networking/cloudflare-dyndns.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/networking/cloudflare-dyndns.nix')
-rw-r--r--nixos/modules/services/networking/cloudflare-dyndns.nix17
1 files changed, 15 insertions, 2 deletions
diff --git a/nixos/modules/services/networking/cloudflare-dyndns.nix b/nixos/modules/services/networking/cloudflare-dyndns.nix
index ab5b1a08539a5..9495c8dcaf810 100644
--- a/nixos/modules/services/networking/cloudflare-dyndns.nix
+++ b/nixos/modules/services/networking/cloudflare-dyndns.nix
@@ -10,6 +10,8 @@ in
     services.cloudflare-dyndns = {
       enable = mkEnableOption "Cloudflare Dynamic DNS Client";
 
+      package = mkPackageOption pkgs "cloudflare-dyndns" { };
+
       apiTokenFile = mkOption {
         type = types.nullOr types.str;
         default = null;
@@ -28,6 +30,16 @@ in
         '';
       };
 
+      frequency = mkOption {
+        type = types.nullOr types.str;
+        default = "*:0/5";
+        description = ''
+          Run cloudflare-dyndns with the given frequency (see
+          {manpage}`systemd.time(7)` for the format).
+          If null, do not run automatically.
+        '';
+      };
+
       proxied = mkOption {
         type = types.bool;
         default = false;
@@ -67,7 +79,6 @@ in
       description = "CloudFlare Dynamic DNS Client";
       after = [ "network.target" ];
       wantedBy = [ "multi-user.target" ];
-      startAt = "*:0/5";
 
       environment = {
         CLOUDFLARE_DOMAINS = toString cfg.domains;
@@ -86,8 +97,10 @@ in
               ++ optional cfg.deleteMissing "--delete-missing"
               ++ optional cfg.proxied "--proxied";
           in
-          "${pkgs.cloudflare-dyndns}/bin/cloudflare-dyndns ${toString args}";
+          "${getExe cfg.package} ${toString args}";
       };
+    } // optionalAttrs (cfg.frequency != null) {
+      startAt = cfg.frequency;
     };
   };
 }