diff options
author | Alan Pearce | 2019-11-12 19:30:35 +0100 |
---|---|---|
committer | Alan Pearce | 2019-11-20 11:14:15 +0100 |
commit | 749f4be1ef9b115c97fa717cc6068ab342c7650c (patch) | |
tree | 1a4041001578e0cb03c1dfd021c1082b71c2a816 /system/modules/darwin/kresd.nix | |
parent | 1078600d993baaf585d91a476f0d03c992817518 (diff) | |
download | nixfiles-749f4be1ef9b115c97fa717cc6068ab342c7650c.tar.lz nixfiles-749f4be1ef9b115c97fa717cc6068ab342c7650c.tar.zst nixfiles-749f4be1ef9b115c97fa717cc6068ab342c7650c.zip |
Configure nextdns usage via module
Diffstat (limited to 'system/modules/darwin/kresd.nix')
-rw-r--r-- | system/modules/darwin/kresd.nix | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/system/modules/darwin/kresd.nix b/system/modules/darwin/kresd.nix new file mode 100644 index 00000000..6bce8af1 --- /dev/null +++ b/system/modules/darwin/kresd.nix @@ -0,0 +1,45 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.kresd; + package = pkgs.knot-resolver; + + configFile = pkgs.writeText "kresd.conf" cfg.extraConfig; +in +{ + options = { + services.kresd.enable = mkOption { + type = types.bool; + default = false; + description = "Whether to enable knot-resolver daemon."; + }; + + services.kresd.extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Extra configuration to be added to the generated configuration file. + ''; + }; + }; + + config = mkIf cfg.enable { + launchd.daemons.kresd = { + command = "${package}/bin/kresd -c ${configFile}"; + + serviceConfig = { + ProcessType = "Interactive"; + # Sockets = { + # Listeners = { + # SockServiceName = "dns"; + # SockFamily = "IPv4"; + # }; + # }; + }; + }; + + environment.systemPackages = [ package ]; + }; +} |