1 { system ? builtins.currentSystem,
3 pkgs ? import ../.. { inherit system config; }
7 inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest;
8 testCombinations = pkgs.lib.cartesianProduct {
9 predictable = [true false];
10 withNetworkd = [true false];
11 systemdStage1 = [true false];
13 in pkgs.lib.listToAttrs (builtins.map ({ predictable, withNetworkd, systemdStage1 }: {
14 name = pkgs.lib.optionalString (!predictable) "un" + "predictable"
15 + pkgs.lib.optionalString withNetworkd "Networkd"
16 + pkgs.lib.optionalString systemdStage1 "SystemdStage1";
18 name = pkgs.lib.optionalString (!predictable) "un" + "predictableInterfaceNames"
19 + pkgs.lib.optionalString withNetworkd "-with-networkd"
20 + pkgs.lib.optionalString systemdStage1 "-systemd-stage-1";
23 nodes.machine = { lib, ... }: let
26 if ${lib.optionalString predictable "!"} ip link show eth0; then
33 networking.usePredictableInterfaceNames = lib.mkForce predictable;
34 networking.useNetworkd = withNetworkd;
35 networking.dhcpcd.enable = !withNetworkd;
36 networking.useDHCP = !withNetworkd;
38 # Check if predictable interface names are working in stage-1
39 boot.initrd.postDeviceCommands = lib.mkIf (!systemdStage1) script;
41 boot.initrd.systemd = lib.mkIf systemdStage1 {
43 initrdBin = [ pkgs.iproute2 ];
44 services.systemd-udev-settle.wantedBy = ["initrd.target"];
45 services.check-interfaces = {
46 requiredBy = ["initrd.target"];
47 after = ["systemd-udev-settle.service"];
48 serviceConfig.Type = "oneshot";
49 path = [ pkgs.iproute2 ];
56 print(machine.succeed("ip link"))
57 machine.${if predictable then "fail" else "succeed"}("ip link show eth0")