Skip to content

Commit

Permalink
nixos/godns: init module
Browse files Browse the repository at this point in the history
Initial implementation of the GoDNS service module. This module allows users to enable and configure the GoDNS service on their NixOS system. It includes options for specifying the GoDNS package and the path to the configuration file.
  • Loading branch information
michaelvanstraten committed Oct 13, 2024
1 parent 8445003 commit 375e072
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2411.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@

- [Fedimint](https://github.com/fedimint/fedimint), a module based system for building federated applications (Federated E-Cash Mint). Available as [services.fedimintd](#opt-services.fedimintd).

- [GoDNS](https://github.com/TimothyYe/godns), a dynamic DNS client written in Go, which supports multiple DNS providers. Available as [services.godns](#opt-services.godns.enable).

## Backward Incompatibilities {#sec-release-24.11-incompatibilities}

- The `sound` options have been removed or renamed, as they had a lot of unintended side effects. See [below](#sec-release-24.11-migration-sound) for details.
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,7 @@
./services/networking/go-neb.nix
./services/networking/go-shadowsocks2.nix
./services/networking/gobgpd.nix
./services/networking/godns.nix
./services/networking/gvpe.nix
./services/networking/hans.nix
./services/networking/harmonia.nix
Expand Down
47 changes: 47 additions & 0 deletions nixos/modules/services/networking/godns.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.godns;

inherit (lib)
mkEnableOption
mkIf
mkOption
mkPackageOption
types
;
in
{

options.services.godns = {
enable = mkEnableOption "GoDNS Service";

package = mkPackageOption pkgs "godns" { };

configPath = mkOption {
type = types.path;
description = "Path to the configuration file for godns.";
example = "/etc/godns/config.json";
};
};

config = mkIf cfg.enable {
systemd.services.godns = {
description = "GoDNS Service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${lib.getExe cfg.package} -c ${cfg.configPath}";
Restart = "always";
KillMode = "process";
RestartSec = "2s";
};
};
};

meta.maintainers = [ lib.maintainers.michaelvanstraten ];
}

0 comments on commit 375e072

Please sign in to comment.