feat(nixosModules/server): add godns dynamic dns
This commit is contained in:
parent
aa777bfa54
commit
c0d02eea1d
3 changed files with 45 additions and 4 deletions
38
modules/nixos/server/default.nix
Normal file
38
modules/nixos/server/default.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{ lib, ... }:
|
||||
{
|
||||
system = {
|
||||
hostname = "nemesis";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue