cfdyndns: init at 0.0.1

This commit is contained in:
Cole Mickens
2016-02-15 12:54:04 -08:00
parent 3a538e674d
commit c7571611dc
6 changed files with 106 additions and 0 deletions
+2
View File
@@ -248,6 +248,7 @@
matrix-synapse = 224;
rspamd = 225;
rmilter = 226;
cfdyndns = 227;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
@@ -473,6 +474,7 @@
matrix-synapse = 224;
rspamd = 225;
rmilter = 226;
cfdyndns = 227;
# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal
+1
View File
@@ -201,6 +201,7 @@
./services/misc/bepasty.nix
./services/misc/canto-daemon.nix
./services/misc/calibre-server.nix
./services/misc/cfdyndns.nix
./services/misc/cpuminer-cryptonight.nix
./services/misc/cgminer.nix
./services/misc/confd.nix
+70
View File
@@ -0,0 +1,70 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.cfdyndns;
in
{
options = {
services.cfdyndns = {
enable = mkEnableOption "Cloudflare Dynamic DNS Client";
email = mkOption {
type = types.str;
description = ''
The email address to use to authenticate to CloudFlare.
'';
};
apikey = mkOption {
type = types.str;
description = ''
The API Key to use to authenticate to CloudFlare.
'';
};
records = mkOption {
default = [];
example = [ "host.tld" ];
type = types.listOf types.str;
description = ''
The records to update in CloudFlare.
'';
};
};
};
config = mkIf cfg.enable {
systemd.services.cfdyndns = {
description = "CloudFlare Dynamic DNS Client";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
startAt = "5 minutes";
serviceConfig = {
Type = "simple";
User = config.ids.uids.cfdyndns;
Group = config.ids.gids.cfdyndns;
ExecStart = "/bin/sh -c '${pkgs.cfdyndns}/bin/cfdyndns'";
};
environment = {
CLOUDFLARE_EMAIL="${cfg.email}";
CLOUDFLARE_APIKEY="${cfg.apikey}";
CLOUDFLARE_RECORDS="${concatStringsSep "," cfg.records}";
};
};
users.extraUsers = {
cfdyndns = {
group = "cfdyndns";
uid = config.ids.uids.cfdyndns;
};
};
users.extraGroups = {
cfdyndns = {
gid = config.ids.gids.cfdyndns;
};
};
};
}