1{ pkgs, lib, ... }:
2{
3 name = "containers-names";
4 meta = {
5 maintainers = with lib.maintainers; [ patryk27 ];
6 };
7
8 nodes.machine =
9 { ... }:
10 {
11 # We're using the newest kernel, so that we can test containers with long names.
12 # Please see https://github.com/NixOS/nixpkgs/issues/38509 for details.
13 boot.kernelPackages = pkgs.linuxPackages_latest;
14
15 containers =
16 let
17 container = subnet: {
18 autoStart = true;
19 privateNetwork = true;
20 hostAddress = "192.168.${subnet}.1";
21 localAddress = "192.168.${subnet}.2";
22 config = { };
23 };
24
25 in
26 {
27 first = container "1";
28 second = container "2";
29 really-long-name = container "3";
30 really-long-long-name-2 = container "4";
31 };
32 };
33
34 testScript = ''
35 machine.wait_for_unit("default.target")
36
37 machine.succeed("ip link show | grep ve-first")
38 machine.succeed("ip link show | grep ve-second")
39 machine.succeed("ip link show | grep ve-really-lFYWO")
40 machine.succeed("ip link show | grep ve-really-l3QgY")
41 '';
42}