-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
f8c6116
commit 54f25d0
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
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"; | ||
}; | ||
|
||
additionalRestartTriggers = mkOption { | ||
default = [ ]; | ||
type = types.listOf types.unspecified; | ||
description = '' | ||
These are additional restart triggers that are passed to the systemd service. | ||
''; | ||
}; | ||
}; | ||
|
||
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"; | ||
}; | ||
restartTriggers = [ ] ++ cfg.additionalRestartTriggers; | ||
}; | ||
}; | ||
|
||
meta.maintainers = [ lib.maintainers.michaelvanstraten ]; | ||
} |