diff --git a/modules/module-list.nix b/modules/module-list.nix index 6375ea38..d7ba5509 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -57,6 +57,7 @@ ./services/synapse-bt.nix ./services/synergy ./services/yabai + ./services/nextdns ./programs/bash ./programs/fish.nix ./programs/gnupg.nix diff --git a/modules/services/nextdns/default.nix b/modules/services/nextdns/default.nix index 3cec4270..23120965 100644 --- a/modules/services/nextdns/default.nix +++ b/modules/services/nextdns/default.nix @@ -30,10 +30,8 @@ in { launchd.daemons.nextdns = { path = [ nextdns ]; - script = '' - "${pkgs.nextdns}/bin/nextdns run ${escapeShellArgs cfg.arguments}"; - ''; - + serviceConfig.ProgramArguments = + [ "${pkgs.nextdns}/bin/nextdns" "run" (escapeShellArgs cfg.arguments) ]; serviceConfig.KeepAlive = true; serviceConfig.RunAtLoad = true; }; diff --git a/release.nix b/release.nix index 2747eb64..6dc3a523 100644 --- a/release.nix +++ b/release.nix @@ -118,6 +118,7 @@ let tests.sockets-nix-daemon = makeTest ./tests/sockets-nix-daemon.nix; tests.services-dnsmasq = makeTest ./tests/services-dnsmasq.nix; tests.services-nix-gc = makeTest ./tests/services-nix-gc.nix; + tests.services-nextdns = makeTest ./tests/services-nextdns.nix; tests.services-ofborg = makeTest ./tests/services-ofborg.nix; tests.services-offlineimap = makeTest ./tests/services-offlineimap.nix; tests.services-privoxy = makeTest ./tests/services-privoxy.nix; diff --git a/tests/services-nextdns.nix b/tests/services-nextdns.nix new file mode 100644 index 00000000..4d6224f2 --- /dev/null +++ b/tests/services-nextdns.nix @@ -0,0 +1,17 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let nextdns = pkgs.runCommand "nextdns-0.0.0" { } "mkdir $out"; + +in { + services.nextdns.enable = true; + services.nextdns.arguments = [ "-config" "10.0.3.0/24=abcdef" ]; + + test = '' + echo >&2 "checking nextdns service in ~/Library/LaunchDaemons" + grep "org.nixos.nextdns" ${config.out}/Library/LaunchDaemons/org.nixos.nextdns.plist + grep "/bin/nextdns" ${config.out}/Library/LaunchDaemons/org.nixos.nextdns.plist + grep "'-config' '10.0.3.0/24=abcdef'" ${config.out}/Library/LaunchDaemons/org.nixos.nextdns.plist + ''; +}