mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
c26c6241ea
This setting will be removed with the switch to systemd-networkd. The use of per interface config is encouraged instead.
28 lines
979 B
Nix
28 lines
979 B
Nix
{ system ? builtins.currentSystem,
|
|
config ? {},
|
|
pkgs ? import ../.. { inherit system config; }
|
|
}:
|
|
|
|
let
|
|
inherit (import ../lib/testing.nix { inherit system pkgs; }) makeTest;
|
|
in pkgs.lib.listToAttrs (pkgs.lib.crossLists (predictable: withNetworkd: {
|
|
name = pkgs.lib.optionalString (!predictable) "un" + "predictable"
|
|
+ pkgs.lib.optionalString withNetworkd "Networkd";
|
|
value = makeTest {
|
|
name = "${if predictable then "" else "un"}predictableInterfaceNames${if withNetworkd then "-with-networkd" else ""}";
|
|
meta = {};
|
|
|
|
machine = { lib, ... }: {
|
|
networking.usePredictableInterfaceNames = lib.mkForce predictable;
|
|
networking.useNetworkd = withNetworkd;
|
|
networking.dhcpcd.enable = !withNetworkd;
|
|
networking.useDHCP = !withNetworkd;
|
|
};
|
|
|
|
testScript = ''
|
|
print $machine->succeed("ip link");
|
|
$machine->${if predictable then "fail" else "succeed"}("ip link show eth0 ");
|
|
'';
|
|
};
|
|
}) [[true false] [true false]])
|