diff options
author | Vladimír Čunát <v@cunat.cz> | 2020-03-13 21:47:07 +0100 |
---|---|---|
committer | Vladimír Čunát <v@cunat.cz> | 2020-03-13 22:05:33 +0100 |
commit | 0729b8c55e0dfaf302af4c57546871d47a652048 (patch) | |
tree | 9f0e22627003b9c258884e37951a1163d714662f /nixos/modules/system/boot/networkd.nix | |
parent | 506be57540a245b575ad72623769d36b398cdde2 (diff) | |
download | nixpkgs-0729b8c55e0dfaf302af4c57546871d47a652048.tar nixpkgs-0729b8c55e0dfaf302af4c57546871d47a652048.tar.gz nixpkgs-0729b8c55e0dfaf302af4c57546871d47a652048.tar.bz2 nixpkgs-0729b8c55e0dfaf302af4c57546871d47a652048.tar.lz nixpkgs-0729b8c55e0dfaf302af4c57546871d47a652048.tar.xz nixpkgs-0729b8c55e0dfaf302af4c57546871d47a652048.tar.zst nixpkgs-0729b8c55e0dfaf302af4c57546871d47a652048.zip |
Revert Merge #82310: nixos/systemd: apply .link
...even when networkd is disabled This reverts commit ce78f3ac701017008aa7f1db387b871b7ae65e01, reversing changes made to dc34da0755b3c36469965659c0ee4a1337e81c05. I'm sorry; Hydra has been unable to evaluate, always returning > error: unexpected EOF reading a line and I've been unable to reproduce the problem locally. Bisecting pointed to this merge, but I still can't see what exactly was wrong.
Diffstat (limited to 'nixos/modules/system/boot/networkd.nix')
-rw-r--r-- | nixos/modules/system/boot/networkd.nix | 75 |
1 files changed, 31 insertions, 44 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index 3078f84f6e9..6dfbe66fc64 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -355,14 +355,6 @@ let }; linkOptions = commonNetworkOptions // { - # overwrite enable option from above - enable = mkOption { - default = true; - type = types.bool; - description = '' - Whether to enable this .link unit. It's handled by udev no matter if <command>systemd-networkd</command> is enabled or not - ''; - }; linkConfig = mkOption { default = {}; @@ -1053,49 +1045,44 @@ in }; - config = mkMerge [ - # .link units are honored by udev, no matter if systemd-networkd is enabled or not. - { - systemd.network.units = mapAttrs' (n: v: nameValuePair "${n}.link" (linkToUnit n v)) cfg.links; - environment.etc = unitFiles; - } + config = mkIf config.systemd.network.enable { - (mkIf config.systemd.network.enable { + users.users.systemd-network.group = "systemd-network"; - users.users.systemd-network.group = "systemd-network"; + systemd.additionalUpstreamSystemUnits = [ + "systemd-networkd.service" "systemd-networkd-wait-online.service" + ]; - systemd.additionalUpstreamSystemUnits = [ - "systemd-networkd.service" "systemd-networkd-wait-online.service" - ]; + systemd.network.units = mapAttrs' (n: v: nameValuePair "${n}.link" (linkToUnit n v)) cfg.links + // mapAttrs' (n: v: nameValuePair "${n}.netdev" (netdevToUnit n v)) cfg.netdevs + // mapAttrs' (n: v: nameValuePair "${n}.network" (networkToUnit n v)) cfg.networks; - 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; + environment.etc = unitFiles; - systemd.services.systemd-networkd = { - wantedBy = [ "multi-user.target" ]; - restartTriggers = attrNames unitFiles; - # prevent race condition with interface renaming (#39069) - requires = [ "systemd-udev-settle.service" ]; - after = [ "systemd-udev-settle.service" ]; - }; + systemd.services.systemd-networkd = { + wantedBy = [ "multi-user.target" ]; + restartTriggers = attrNames unitFiles; + # prevent race condition with interface renaming (#39069) + requires = [ "systemd-udev-settle.service" ]; + after = [ "systemd-udev-settle.service" ]; + }; - systemd.services.systemd-networkd-wait-online = { - wantedBy = [ "network-online.target" ]; - }; + systemd.services.systemd-networkd-wait-online = { + wantedBy = [ "network-online.target" ]; + }; - systemd.services."systemd-network-wait-online@" = { - description = "Wait for Network Interface %I to be Configured"; - conflicts = [ "shutdown.target" ]; - requisite = [ "systemd-networkd.service" ]; - after = [ "systemd-networkd.service" ]; - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = true; - ExecStart = "${config.systemd.package}/lib/systemd/systemd-networkd-wait-online -i %I"; - }; + systemd.services."systemd-network-wait-online@" = { + description = "Wait for Network Interface %I to be Configured"; + conflicts = [ "shutdown.target" ]; + requisite = [ "systemd-networkd.service" ]; + after = [ "systemd-networkd.service" ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + ExecStart = "${config.systemd.package}/lib/systemd/systemd-networkd-wait-online -i %I"; }; + }; - services.resolved.enable = mkDefault true; - }) - ]; + services.resolved.enable = mkDefault true; + }; } |