1import ./make-test.nix ({ pkgs, ... }: {
2 name = "dnscrypt-proxy";
3 meta = with pkgs.stdenv.lib.maintainers; {
4 maintainers = [ joachifm ];
5 };
6
7 nodes = {
8 # A client running the recommended setup: DNSCrypt proxy as a forwarder
9 # for a caching DNS client.
10 client =
11 { config, pkgs, ... }:
12 let localProxyPort = 43; in
13 {
14 security.apparmor.enable = true;
15
16 services.dnscrypt-proxy.enable = true;
17 services.dnscrypt-proxy.localPort = localProxyPort;
18
19 services.dnsmasq.enable = true;
20 services.dnsmasq.servers = [ "127.0.0.1#${toString localProxyPort}" ];
21 };
22 };
23
24 testScript = ''
25 $client->start;
26 $client->waitForUnit("sockets.target");
27 $client->waitForUnit("dnsmasq");
28
29 # The daemon is socket activated; sending a single ping should activate it.
30 $client->execute("${pkgs.iputils}/bin/ping -c1 example.com");
31 $client->succeed("systemctl is-active dnscrypt-proxy");
32 '';
33})