{ 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 ]; }; }