aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/modules/services/networking/nextdns.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/services/networking/nextdns.nix')
-rw-r--r--nixpkgs/nixos/modules/services/networking/nextdns.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/services/networking/nextdns.nix b/nixpkgs/nixos/modules/services/networking/nextdns.nix
new file mode 100644
index 00000000000..a633bff62ec
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/networking/nextdns.nix
@@ -0,0 +1,44 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.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.";
+ };
+ };
+ };
+
+ # https://github.com/nextdns/nextdns/blob/628ea509eaaccd27adb66337db03e5b56f6f38a8/host/service/systemd/service.go
+ config = mkIf cfg.enable {
+ systemd.services.nextdns = {
+ description = "NextDNS DNS/53 to DoH Proxy";
+ environment = {
+ SERVICE_RUN_MODE = "1";
+ };
+ serviceConfig = {
+ StartLimitInterval = 5;
+ StartLimitBurst = 10;
+ ExecStart = "${pkgs.nextdns}/bin/nextdns run ${escapeShellArgs config.services.nextdns.arguments}";
+ RestartSec = 120;
+ LimitMEMLOCK = "infinity";
+ };
+ after = [ "network.target" ];
+ before = [ "nss-lookup.target" ];
+ wants = [ "nss-lookup.target" ];
+ wantedBy = [ "multi-user.target" ];
+ };
+ };
+}