You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

predictable-interface-names.nix 979B

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