Merge pull request #163220 from fleaz/init-r53_ddns
commit
05232d19b6
@ -0,0 +1,72 @@ |
||||
{ config, lib, pkgs, ... }: |
||||
|
||||
with lib; |
||||
|
||||
let |
||||
cfg = config.services.r53-ddns; |
||||
pkg = pkgs.r53-ddns; |
||||
in |
||||
{ |
||||
options = { |
||||
services.r53-ddns = { |
||||
|
||||
enable = mkEnableOption "r53-ddyns"; |
||||
|
||||
interval = mkOption { |
||||
type = types.str; |
||||
default = "15min"; |
||||
description = "How often to update the entry"; |
||||
}; |
||||
|
||||
zoneID = mkOption { |
||||
type = types.str; |
||||
description = "The ID of your zone in Route53"; |
||||
}; |
||||
|
||||
domain = mkOption { |
||||
type = types.str; |
||||
description = "The name of your domain in Route53"; |
||||
}; |
||||
|
||||
hostname = mkOption { |
||||
type = types.str; |
||||
description = '' |
||||
Manually specify the hostname. Otherwise the tool will try to use the name |
||||
returned by the OS (Call to gethostname) |
||||
''; |
||||
}; |
||||
|
||||
environmentFile = mkOption { |
||||
type = types.str; |
||||
description = '' |
||||
File containing the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY |
||||
in the format of an EnvironmentFile as described by systemd.exec(5) |
||||
''; |
||||
}; |
||||
|
||||
}; |
||||
}; |
||||
|
||||
config = mkIf cfg.enable { |
||||
|
||||
systemd.timers.r53-ddns = { |
||||
description = "r53-ddns timer"; |
||||
wantedBy = [ "timers.target" ]; |
||||
timerConfig = { |
||||
OnBootSec = cfg.interval; |
||||
OnUnitActiveSec = cfg.interval; |
||||
}; |
||||
}; |
||||
|
||||
systemd.services.r53-ddns = { |
||||
description = "r53-ddns service"; |
||||
serviceConfig = { |
||||
ExecStart = "${pkg}/bin/r53-ddns -zone-id ${cfg.zoneID} -domain ${cfg.domain}" |
||||
+ lib.optionalString (cfg.hostname != null) " -hostname ${cfg.hostname}"; |
||||
EnvironmentFile = "${cfg.environmentFile}"; |
||||
DynamicUser = true; |
||||
}; |
||||
}; |
||||
|
||||
}; |
||||
} |
@ -0,0 +1,22 @@ |
||||
{ buildGoModule, fetchFromGitHub, lib }: |
||||
|
||||
buildGoModule rec { |
||||
pname = "r53-ddns"; |
||||
version = "1.0.1"; |
||||
|
||||
src = fetchFromGitHub { |
||||
owner = "fleaz"; |
||||
repo = "r53-ddns"; |
||||
rev = "v${version}"; |
||||
sha256 = "sha256:1pvd1karq1p81rkq2n7mh040n29f7wb8701ax6g2sqm1yz7gxd08"; |
||||
}; |
||||
|
||||
vendorSha256 = "sha256:1jhwds57gi548ahnh5m342csrs5rv9ysy7fqmfvg5w2s9slswq77"; |
||||
|
||||
meta = with lib; { |
||||
license = licenses.mit; |
||||
homepage = "https://github.com/fleaz/r53-ddns"; |
||||
description = "A DIY DynDNS tool based on Route53"; |
||||
maintainers = with maintainers; [ fleaz ]; |
||||
}; |
||||
} |
Loading…
Reference in new issue