summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2020-11-08 14:05:33 +0100
committerGitHub <noreply@github.com>2020-11-08 14:05:33 +0100
commit56f01699fbe462ae9f361ff08d2dbb9e898b9439 (patch)
treee65e2ee1cc5e16b411caeb925314fac0bc1177c1 /modules
parent1145503ef97c41b3358ed2f49fcdd17ec45a460a (diff)
parentee55d78034d9a49c2b7f643d66a8f6d8ee2b32d3 (diff)
Merge pull request #245 from happysalada/master
modules: add nextdns service
Diffstat (limited to 'modules')
-rw-r--r--modules/services/nextdns/default.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/modules/services/nextdns/default.nix b/modules/services/nextdns/default.nix
new file mode 100644
index 0000000..3cec427
--- /dev/null
+++ b/modules/services/nextdns/default.nix
@@ -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.daemons.nextdns = {
+ path = [ nextdns ];
+ script = ''
+ "${pkgs.nextdns}/bin/nextdns run ${escapeShellArgs cfg.arguments}";
+ '';
+
+ serviceConfig.KeepAlive = true;
+ serviceConfig.RunAtLoad = true;
+ };
+
+ };
+}