Skip to content

Commit 6f061f3

Browse files
authored
nixos/godns: init module (#348290)
2 parents 37697c4 + a890891 commit 6f061f3

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
lines changed

maintainers/maintainer-list.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15652,6 +15652,12 @@
1565215652
github = "michaelshmitty";
1565315653
githubId = 114845;
1565415654
};
15655+
michaelvanstraten = {
15656+
name = "Michael van Straten";
15657+
email = "[email protected]";
15658+
github = "michaelvanstraten";
15659+
githubId = 50352631;
15660+
};
1565515661
michalrus = {
1565615662
email = "[email protected]";
1565715663
github = "michalrus";

nixos/doc/manual/release-notes/rl-2505.section.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@
214214
- [ipfs-cluster](https://ipfscluster.io/), Pinset orchestration for IPFS. Available as [services.ipfs-cluster](#opt-services.ipfs-cluster.enable)
215215

216216
- [bitbox-bridge](https://github.com/BitBoxSwiss/bitbox-bridge), a bridge software that connects BitBox hardware wallets to computers & web wallets like [Rabby](https://rabby.io/). Allows one to interact & transact with smart contracts, Web3 websites & financial services without storing private keys anywhere other than the hardware wallet. Available as [services.bitbox-bridge](#opt-services.bitbox-bridge.enable).
217+
218+
- [GoDNS](https://github.com/TimothyYe/godns), a dynamic DNS client written in Go, which supports multiple DNS providers. Available as [services.godns](option.html#opt-services.godns.enable).
219+
217220
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
218221

219222
## Backward Incompatibilities {#sec-release-25.05-incompatibilities}

nixos/modules/module-list.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,7 @@
11371137
./services/networking/go-shadowsocks2.nix
11381138
./services/networking/gobgpd.nix
11391139
./services/networking/gokapi.nix
1140+
./services/networking/godns.nix
11401141
./services/networking/gvpe.nix
11411142
./services/networking/hans.nix
11421143
./services/networking/harmonia.nix
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
config,
3+
lib,
4+
pkgs,
5+
...
6+
}:
7+
let
8+
inherit (lib)
9+
mkEnableOption
10+
mkIf
11+
mkOption
12+
mkPackageOption
13+
types
14+
;
15+
16+
cfg = config.services.godns;
17+
18+
settingsFormat = pkgs.formats.yaml { };
19+
in
20+
{
21+
options.services.godns = {
22+
enable = mkEnableOption "GoDNS service";
23+
24+
package = mkPackageOption pkgs "godns" { };
25+
26+
settings = mkOption {
27+
type = types.submodule {
28+
freeformType = settingsFormat.type;
29+
};
30+
31+
description = ''
32+
Configuration for GoDNS. Refer to the [configuration section](1) in the
33+
GoDNS GitHub repository for details.
34+
35+
[1]: https://github.com/TimothyYe/godns?tab=readme-ov-file#configuration
36+
'';
37+
38+
example = {
39+
provider = "Cloudflare";
40+
login_token_file = "$CREDENTIALS_DIRECTORY/login_token";
41+
domains = [
42+
{
43+
domain_name = "example.com";
44+
sub_domains = [ "foo" ];
45+
}
46+
];
47+
ipv6_urls = [
48+
"https://api6.ipify.org"
49+
"https://ip2location.io/ip"
50+
"https://v6.ipinfo.io/ip"
51+
];
52+
ip_type = "IPv6";
53+
interval = 300;
54+
};
55+
};
56+
57+
loadCredential = lib.mkOption {
58+
type = types.listOf types.str;
59+
default = [ ];
60+
example = [ "login_token:/path/to/login_token" ];
61+
description = ''
62+
This can be used to pass secrets to the systemd service without adding
63+
them to the nix store.
64+
'';
65+
};
66+
};
67+
68+
config = mkIf cfg.enable {
69+
systemd.services.godns = {
70+
description = "GoDNS service";
71+
wantedBy = [ "multi-user.target" ];
72+
after = [ "network.target" ];
73+
serviceConfig = {
74+
DynamicUser = true;
75+
ExecStart = "${lib.getExe cfg.package} -c ${settingsFormat.generate "config.yaml" cfg.settings}";
76+
LoadCredential = cfg.loadCredential;
77+
Restart = "always";
78+
RestartSec = "2s";
79+
};
80+
};
81+
};
82+
83+
meta.maintainers = [ lib.maintainers.michaelvanstraten ];
84+
}

0 commit comments

Comments
 (0)