@@ -1,52 +0,0 @@
1−import ./make-test.nix (let
2−
3− container = { ... }: {
4− boot.isContainer = true;
5−
6− # use networkd to obtain systemd network setup
7− networking.useNetworkd = true;
8−
9− # systemd-nspawn expects /sbin/init
10− boot.loader.initScript.enable = true;
11−
12− imports = [ ../modules/profiles/minimal.nix ];
13− };
14−
15− containerSystem = (import ../lib/eval-config.nix {
16− modules = [ container ];
17− }).config.system.build.toplevel;
18−
19− containerName = "container";
20− containerRoot = "/var/lib/machines/${containerName}";
21−
22−in {
23− name = "systemd-machinectl";
24−
25− machine = { lib, ... }: {
26− # use networkd to obtain systemd network setup
27− networking.useNetworkd = true;
28−
29− # open DHCP server on interface to container
30− networking.firewall.trustedInterfaces = [ "ve-+" ];
31−
32− # do not try to access cache.nixos.org
33− nix.binaryCaches = lib.mkForce [];
34−
35− virtualisation.pathsInNixDB = [ containerSystem ];
36− };
37−
38− testScript = ''
39− startAll;
40−
41− $machine->waitForUnit("default.target");
42− $machine->succeed("mkdir -p ${containerRoot}");
43− $machine->succeed("nixos-install --root ${containerRoot} --system ${containerSystem} --no-channel-copy --no-root-passwd --no-bootloader");
44−
45− $machine->succeed("machinectl start ${containerName}");
46− $machine->waitUntilSucceeds("systemctl -M ${containerName} is-active default.target");
47− $machine->succeed("ping -n -c 1 ${containerName}");
48− $machine->succeed("test `stat ${containerRoot}/var/empty -c %u%g` != 00");
49−
50− $machine->succeed("machinectl stop ${containerName}");
51− '';
52−})