feat(nixosModules/server): add godns dynamic dns

This commit is contained in:
Mohammad Rafiq 2025-05-29 15:10:57 +08:00
parent aa777bfa54
commit c0d02eea1d
No known key found for this signature in database
3 changed files with 45 additions and 4 deletions

View file

@ -0,0 +1,38 @@
{ lib, config, ... }:
{
options.server = {
enableDDNS = lib.mkEnableOption "";
};
config = lib.mkMerge [
(lib.mkIf config.server.enableDDNS {
services.godns = {
enable = true;
loadCredential = [
"cf_token:${config.sops.secrets."keys/cloudflare".path}"
];
settings = {
provider = "Cloudflare";
login_token_file = "$CREDENTIALS_DIRECTORY/cf_token";
domains = [
{
domain_name = "rrv.sh";
sub_domains = [
"@"
];
}
];
resolver = "1.1.1.1";
ip_urls = [
"https://wtfismyip.com/text"
"https://api.ipify.org"
"https://myip.biturl.top"
"https://api-ipv4.ip.sb/ip"
];
ip_type = "IPv4";
interval = 300;
};
};
})
];
}

View file

@ -3,12 +3,14 @@
...
}:
{
system = {
hostname = "apollo";
mainUser.name = "rafiq";
mainUser.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n";
bootloader = "systemd-boot";
};
hardware = {
platform = "intel";
drives.btrfs = {
@ -18,5 +20,9 @@
};
};
server = {
enableDDNS = true;
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View file

@ -1,7 +1,4 @@
{
lib,
...
}:
{ lib, ... }:
{
system = {
hostname = "nemesis";