1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-09 10:17:02 +00:00
nix-darwin/modules/services/nextdns/default.nix
2020-11-27 11:28:26 +09:00

40 lines
917 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.nextdns;
nextdns = pkgs.nextdns;
in {
options = {
services.nextdns = {
enable = mkOption {
type = types.bool;
default = false;
description =
"Whether to enable the NextDNS DNS/53 to DoH Proxy service.";
};
arguments = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "-config" "10.0.3.0/24=abcdef" ];
description = "Additional arguments to be passed to nextdns run.";
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ nextdns ];
launchd.daemons.nextdns = {
path = [ nextdns ];
serviceConfig.ProgramArguments =
[ "${pkgs.nextdns}/bin/nextdns" "run" (escapeShellArgs cfg.arguments) ];
serviceConfig.KeepAlive = true;
serviceConfig.RunAtLoad = true;
};
};
}