summary refs log blame commit diff
path: root/nixos/tests/dnscrypt-proxy.nix
blob: 845623368250cf405125d2b28ee6c392f3dc8f60 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                           
                                                                          






                                                                            
                                    


                                                                               
                                                           

     
import ./make-test.nix ({ pkgs, ... }: {
  name = "dnscrypt-proxy";
  meta = with pkgs.stdenv.lib.maintainers; {
    maintainers = [ joachifm ];
  };

  nodes = {
    # A client running the recommended setup: DNSCrypt proxy as a forwarder
    # for a caching DNS client.
    client =
    { config, pkgs, ... }:
    let localProxyPort = 43; in
    {
      security.apparmor.enable = true;

      services.dnscrypt-proxy.enable = true;
      services.dnscrypt-proxy.localPort = localProxyPort;
      services.dnscrypt-proxy.extraArgs = [ "-X libdcplugin_example.so" ];

      services.dnsmasq.enable = true;
      services.dnsmasq.servers = [ "127.0.0.1#${toString localProxyPort}" ];
    };
  };

  testScript = ''
    $client->waitForUnit("dnsmasq");

    # The daemon is socket activated; sending a single ping should activate it.
    $client->execute("${pkgs.iputils}/bin/ping -c1 example.com");
    $client->succeed("systemctl is-active dnscrypt-proxy");
  '';
})