1{ system ? builtins.currentSystem
2, pkgs ? import ../.. { inherit system; }
3}:
4with import ../lib/testing.nix { inherit system; };
5let boolToString = x: if x then "yes" else "no"; in
6let testWhenSetTo = predictable: withNetworkd:
7makeTest {
8 name = "${if predictable then "" else "un"}predictableInterfaceNames${if withNetworkd then "-with-networkd" else ""}";
9 meta = {};
10
11 machine = { config, pkgs, ... }: {
12 networking.usePredictableInterfaceNames = pkgs.stdenv.lib.mkForce predictable;
13 networking.useNetworkd = withNetworkd;
14 networking.dhcpcd.enable = !withNetworkd;
15 };
16
17 testScript = ''
18 print $machine->succeed("ip link");
19 $machine->succeed("ip link show ${if predictable then "ens3" else "eth0"}");
20 $machine->fail("ip link show ${if predictable then "eth0" else "ens3"}");
21 '';
22}; in
23with pkgs.stdenv.lib.lists;
24with pkgs.stdenv.lib.attrsets;
25listToAttrs (map (drv: nameValuePair drv.name drv) (
26crossLists testWhenSetTo [[true false] [true false]]
27))