nixos/networkd: respect systemd.network.links also with disabled systemd-networkd

This mirrors the behaviour of systemd - It's udev that parses `.link`
files, not `systemd-networkd`.
This commit is contained in:
Florian Klink
2020-03-11 10:21:37 +01:00
parent 1115959a8d
commit 36ef112a47
3 changed files with 79 additions and 33 deletions
+25
View File
@@ -654,6 +654,31 @@ let
), "The IPv6 routing table has not been properly cleaned:\n{}".format(ipv6Residue)
'';
};
# even with disabled networkd, systemd.network.links should work
# (as it's handled by udev, not networkd)
link = {
name = "Link";
nodes.client = { pkgs, ... }: {
virtualisation.vlans = [ 1 ];
networking = {
useNetworkd = networkd;
useDHCP = false;
};
systemd.network.links."50-foo" = {
matchConfig = {
Name = "foo";
Driver = "dummy";
};
linkConfig.MTUBytes = "1442";
};
};
testScript = ''
print(client.succeed("ip l add name foo type dummy"))
print(client.succeed("stat /etc/systemd/network/50-foo.link"))
client.succeed("udevadm settle")
assert "mtu 1442" in client.succeed("ip l show dummy0")
'';
};
};
in pkgs.lib.mapAttrs (pkgs.lib.const (attrs: makeTest (attrs // {