anchor.diff: +# This test runs a Bittorrent tracker on one machine, and verifies
  +# that two client machines can download the torrent using
  +# `transmission'.  The first client (behind a NAT router) downloads
  +# from the initial seeder running on the tracker.  Then we kill the
  +# initial seeder.  The second client downloads from the first client,
  +# which only works if the first client successfully uses the UPnP-IGD
  +# protocol to poke a hole in the NAT.
  +
   { pkgs, ... }:
   
   let
   
     # Some random file to serve.
     file = pkgs.nixUnstable.src;
  +
  +  miniupnpdConf = pkgs.writeText "miniupnpd.conf"
  +    ''
  +      ext_ifname=eth1
  +      listening_ip=192.168.2.3/24
  +      allow 1024-65535 192.168.2.0/24 1024-65535
  +    '';
     
   in
   
  
positive.code:       $tracker->waitForOpenPort(6969);
  
        # Start the initial seeder.
        $tracker->mustSucceed("transmissioncli /tmp/test.torrent -M -w /tmp/data >&2 &");
  
        # Now we should be able to download from the client.
        $tracker->waitForJob("httpd");
        $client->mustSucceed("transmissioncli http://tracker/test.torrent -M -w /tmp >&2 &");
        $client->waitForFile("/tmp/test.tar.bz2");
        $client->mustSucceed("cmp /tmp/test.tar.bz2 ${file}");
      '';
    
  }
  
negative.code:           services.httpd.documentRoot = "/tmp";
          };
  
        router = 
          { config, pkgs, ... }:
          { environment.systemPackages = [ pkgs.iptables pkgs.miniupnpd ];
            virtualisation.vlans = [ 1 2 ];
          };
  
        client1 = 
          { config, pkgs, ... }:
          { environment.systemPackages = [ pkgs.transmission ];
            virtualisation.vlans = [ 2 ];
            networking.defaultGateway = "192.168.2.3"; # !!! ugly
          };
  
        client2 = 
          { config, pkgs, ... }:
          { environment.systemPackages = [ pkgs.transmission ];
          };
  