2024-06-25 04:04:39 +03:00
|
|
|
{ container, lib, config, ... } @args: with lib; let
|
|
|
|
cfg = config.container.module.ddns;
|
2024-06-09 23:35:53 +03:00
|
|
|
in {
|
2024-06-25 04:04:39 +03:00
|
|
|
options = {
|
|
|
|
container.module.ddns = {
|
|
|
|
enable = mkEnableOption "Dynamic dns client.";
|
|
|
|
address = mkOption {
|
|
|
|
default = "10.1.0.31";
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
storage = mkOption {
|
|
|
|
default = "${config.container.storage}/ddns";
|
|
|
|
type = types.str;
|
2024-06-09 23:35:53 +03:00
|
|
|
};
|
|
|
|
};
|
2024-06-25 04:04:39 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.tmpfiles.rules = container.mkContainerDir cfg [
|
|
|
|
"data"
|
|
|
|
];
|
|
|
|
|
|
|
|
containers.ddns = container.mkContainer cfg {
|
|
|
|
bindMounts = {
|
|
|
|
"/data" = {
|
|
|
|
hostPath = "${cfg.storage}/data";
|
|
|
|
isReadOnly = true;
|
|
|
|
};
|
|
|
|
};
|
2024-06-09 23:35:53 +03:00
|
|
|
|
2024-06-25 04:04:39 +03:00
|
|
|
config = { ... }: container.mkContainerConfig cfg {
|
|
|
|
services.cloudflare-dyndns = {
|
|
|
|
enable = true;
|
|
|
|
apiTokenFile = "/data/token";
|
|
|
|
deleteMissing = true;
|
|
|
|
ipv4 = true;
|
|
|
|
ipv6 = false;
|
|
|
|
proxied = false;
|
|
|
|
domains = let
|
|
|
|
domain = config.container.domain;
|
2024-07-05 15:23:03 +03:00
|
|
|
in [ domain ] ++ map (sub: "${sub}.${domain}") [
|
2024-06-25 04:04:39 +03:00
|
|
|
"cloud"
|
|
|
|
"git"
|
|
|
|
"mail"
|
|
|
|
"office"
|
|
|
|
"paste"
|
|
|
|
"play"
|
|
|
|
"vpn"
|
2024-07-03 12:15:24 +03:00
|
|
|
"fmp-git"
|
|
|
|
"fmp-cloud"
|
2024-07-05 15:23:03 +03:00
|
|
|
"fmp-dev"
|
2024-06-25 04:04:39 +03:00
|
|
|
];
|
|
|
|
};
|
2024-06-09 23:35:53 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|