1 { config, pkgs, lib, ... }:
6 cfg = config.services.cfdyndns;
10 (mkRemovedOptionModule
11 [ "services" "cfdyndns" "apikey" ]
12 "Use services.cfdyndns.apikeyFile instead.")
17 enable = mkEnableOption (lib.mdDoc "Cloudflare Dynamic DNS Client");
21 description = lib.mdDoc ''
22 The email address to use to authenticate to CloudFlare.
26 apikeyFile = mkOption {
28 type = types.nullOr types.str;
29 description = lib.mdDoc ''
30 The path to a file containing the API Key
31 used to authenticate with CloudFlare.
37 example = [ "host.tld" ];
38 type = types.listOf types.str;
39 description = lib.mdDoc ''
40 The records to update in CloudFlare.
46 config = mkIf cfg.enable {
47 systemd.services.cfdyndns = {
48 description = "CloudFlare Dynamic DNS Client";
49 after = [ "network.target" ];
50 wantedBy = [ "multi-user.target" ];
54 User = config.ids.uids.cfdyndns;
55 Group = config.ids.gids.cfdyndns;
58 CLOUDFLARE_EMAIL="${cfg.email}";
59 CLOUDFLARE_RECORDS="${concatStringsSep "," cfg.records}";
62 ${optionalString (cfg.apikeyFile != null) ''
63 export CLOUDFLARE_APIKEY="$(cat ${escapeShellArg cfg.apikeyFile})"
65 ${pkgs.cfdyndns}/bin/cfdyndns
72 uid = config.ids.uids.cfdyndns;
78 gid = config.ids.gids.cfdyndns;