nixpkgs/nixos/modules/services/networking/r53-ddns.nix
pennae 2e751c0772 treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
2022-07-30 15:16:34 +02:00

73 lines
1.7 KiB
Nix

{ 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 = lib.mdDoc "How often to update the entry";
};
zoneID = mkOption {
type = types.str;
description = lib.mdDoc "The ID of your zone in Route53";
};
domain = mkOption {
type = types.str;
description = lib.mdDoc "The name of your domain in Route53";
};
hostname = mkOption {
type = types.str;
description = lib.mdDoc ''
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 = lib.mdDoc ''
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;
};
};
};
}