# Pieces shared by the VM tests. { # `fail` in a test script also passes on "command not found", so make sure # the tools the scripts rely on are really there. tools = { pkgs, ... }: { environment.systemPackages = with pkgs; [ dnsutils netcat-openbsd curl tcpdump wireguard-tools jq ]; }; # channels.nixos.org as a test sees it: `/git-revision` is a redirect to # /files//git-revision, served from /srv/channels on port 8080. channelServer = pkgs: pkgs.writeScript "channels.py" '' #!${pkgs.python3}/bin/python3 import http.server class Handler(http.server.SimpleHTTPRequestHandler): def __init__(self, *args, **kwargs): super().__init__(*args, directory="/srv/channels", **kwargs) def do_GET(self): parts = self.path.strip("/").split("/") if len(parts) == 2 and parts[1] == "git-revision": self.send_response(302) self.send_header("Location", "/files/" + self.path.strip("/")) self.end_headers() else: super().do_GET() http.server.ThreadingHTTPServer(("0.0.0.0", 8080), Handler).serve_forever() ''; # `driverInteractive` uses the full QEMU, which would open a window per VM; # `nix run .#lab` wants the consoles in the terminal instead. interactiveDefaults.virtualisation.qemu.options = [ "-display" "none" ]; }