mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
modules: add nextdns service
This commit is contained in:
parent
842c72f1c9
commit
aa739bc24d
1 changed files with 42 additions and 0 deletions
42
modules/services/nextdns/default.nix
Normal file
42
modules/services/nextdns/default.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{ 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.user.agents.nextdns = {
|
||||
path = [ nextdns ];
|
||||
script = ''
|
||||
"${pkgs.nextdns}/bin/nextdns run ${escapeShellArgs cfg.arguments}";
|
||||
'';
|
||||
|
||||
serviceConfig.KeepAlive = true;
|
||||
serviceConfig.RunAtLoad = true;
|
||||
};
|
||||
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue