The update test upgrades nixpkgs first; the pin and the lock must survive a rolled-back update, a confirmed one and the rebuild after it. The channel server moves to the shared test helpers. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeFqV9dZrK6nipHkPfyM4F
49 lines
1.5 KiB
Nix
49 lines
1.5 KiB
Nix
# 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: `<branch>/git-revision` is a redirect to
|
|
# /files/<branch>/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"
|
|
];
|
|
}
|