forked from mirrors/nixpkgs
nixos/networkd: Make activatible through dbus and netlink
With this systemd buffers netlink messages in early boot from the kernel itself; and passes them on to networkd for processing once it's started. Makes sure no routing messages are missed. Also makes an alias so that dbus can activate this unit. Upstream has this too.
This commit is contained in:
parent
0e18e5db99
commit
cd1dedac67
|
@ -1178,14 +1178,22 @@ in
|
||||||
users.users.systemd-network.group = "systemd-network";
|
users.users.systemd-network.group = "systemd-network";
|
||||||
|
|
||||||
systemd.additionalUpstreamSystemUnits = [
|
systemd.additionalUpstreamSystemUnits = [
|
||||||
"systemd-networkd.service" "systemd-networkd-wait-online.service"
|
"systemd-networkd-wait-online.service"
|
||||||
|
"systemd-networkd.service"
|
||||||
|
"systemd-networkd.socket"
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.network.units = mapAttrs' (n: v: nameValuePair "${n}.netdev" (netdevToUnit n v)) cfg.netdevs
|
systemd.network.units = mapAttrs' (n: v: nameValuePair "${n}.netdev" (netdevToUnit n v)) cfg.netdevs
|
||||||
// mapAttrs' (n: v: nameValuePair "${n}.network" (networkToUnit n v)) cfg.networks;
|
// mapAttrs' (n: v: nameValuePair "${n}.network" (networkToUnit n v)) cfg.networks;
|
||||||
|
|
||||||
|
# systemd-networkd is socket-activated by kernel netlink route change
|
||||||
|
# messages. It is important to have systemd buffer those on behalf of
|
||||||
|
# networkd.
|
||||||
|
systemd.sockets.systemd-networkd.wantedBy = [ "sockets.target" ];
|
||||||
|
|
||||||
systemd.services.systemd-networkd = {
|
systemd.services.systemd-networkd = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
aliases = [ "dbus-org.freedesktop.network1.service" ];
|
||||||
restartTriggers = map (x: x.source) (attrValues unitFiles);
|
restartTriggers = map (x: x.source) (attrValues unitFiles);
|
||||||
# prevent race condition with interface renaming (#39069)
|
# prevent race condition with interface renaming (#39069)
|
||||||
requires = [ "systemd-udev-settle.service" ];
|
requires = [ "systemd-udev-settle.service" ];
|
||||||
|
|
Loading…
Reference in a new issue