2020-11-05 13:06:51 +09:00
|
|
|
{ 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 =
|
2024-04-14 23:02:32 +02:00
|
|
|
"Whether to enable the NextDNS DNS/53 to DoH Proxy service.";
|
2020-11-05 13:06:51 +09:00
|
|
|
};
|
|
|
|
arguments = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [ ];
|
|
|
|
example = [ "-config" "10.0.3.0/24=abcdef" ];
|
2024-04-14 23:02:32 +02:00
|
|
|
description = "Additional arguments to be passed to nextdns run.";
|
2020-11-05 13:06:51 +09:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
environment.systemPackages = [ nextdns ];
|
|
|
|
|
2020-11-27 11:28:26 +09:00
|
|
|
launchd.daemons.nextdns = {
|
2020-11-05 13:06:51 +09:00
|
|
|
path = [ nextdns ];
|
2020-11-27 11:28:26 +09:00
|
|
|
serviceConfig.ProgramArguments =
|
2024-07-08 16:36:31 -03:00
|
|
|
[ "${pkgs.nextdns}/bin/nextdns" "run" ] ++ cfg.arguments;
|
2020-11-05 13:06:51 +09:00
|
|
|
serviceConfig.KeepAlive = true;
|
|
|
|
serviceConfig.RunAtLoad = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|