nix/container/Ddns.nix

60 lines
1.1 KiB
Nix
Raw Normal View History

{
2024-11-04 04:37:29 +03:00
config,
container,
lib,
...
}: let
cfg = config.container.module.ddns;
in {
options.container.module.ddns = {
enable = lib.mkEnableOption "the dynamic dns client.";
address = lib.mkOption {
default = "10.1.0.31";
type = lib.types.str;
};
storage = lib.mkOption {
default = "${config.container.storage}/ddns";
type = lib.types.str;
};
};
2024-06-25 04:04:39 +03:00
2024-11-04 04:37:29 +03:00
config = lib.mkIf cfg.enable {
systemd.tmpfiles.rules = container.mkContainerDir cfg [
"data"
];
2024-06-25 04:04:39 +03:00
2024-11-04 04:37:29 +03:00
containers.ddns = container.mkContainer cfg {
bindMounts = {
"/data" = {
hostPath = "${cfg.storage}/data";
isReadOnly = true;
};
};
2024-06-09 23:35:53 +03:00
2024-11-04 04:37:29 +03:00
config = { ... }: container.mkContainerConfig cfg {
services.cloudflare-dyndns = {
enable = true;
apiTokenFile = "/data/token";
deleteMissing = false;
ipv4 = true;
2024-11-30 22:47:54 +03:00
ipv6 = true;
2024-11-04 04:37:29 +03:00
proxied = false;
domains = let
domain = config.container.domain;
in [
domain
] ++ map (sub: "${sub}.${domain}") [
"cloud"
"git"
"mail"
"office"
"paste"
"play"
"vpn"
];
};
};
};
};
2024-06-09 23:35:53 +03:00
}