nixos/systemd-networkd: align config with upstream (#499872)

This commit is contained in:
Florian Klink
2026-04-03 15:55:46 +00:00
committed by GitHub
3 changed files with 1140 additions and 408 deletions
@@ -305,6 +305,8 @@ See <https://github.com/NixOS/nixpkgs/issues/481673>.
- Support for Bluetooth audio based on `bluez-alsa` has been added to the `hardware.alsa` module. It can be enabled with the new [enableBluetooth](#opt-hardware.alsa.enableBluetooth) option.
- `systemd.network.*` has been updated to support all configuration options from upstream `networkd` version 259.
- `services.openssh` now supports generating host SSH keys by setting `services.openssh.generateHostKeys = true` while leaving `services.openssh.enable` disabled. This is particularly useful for systems that have no need of an SSH daemon but want SSH host keys for other purposes such as using agenix or sops-nix.
- IPVLAN interfaces can now be configured through the `networking.ipvlans` option in the networking module.
+96 -28
View File
@@ -41,6 +41,14 @@ in
[VLAN]
${attrsToSection def.vlanConfig}
''
+ optionalString (def.macvlanConfig != { }) ''
[MACVLAN]
${attrsToSection def.macvlanConfig}
''
+ optionalString (def.macvtapConfig != { }) ''
[MACVTAP]
${attrsToSection def.macvtapConfig}
''
+ optionalString (def.ipvlanConfig != { }) ''
[IPVLAN]
${attrsToSection def.ipvlanConfig}
@@ -49,14 +57,50 @@ in
[IPVTAP]
${attrsToSection def.ipvtapConfig}
''
+ optionalString (def.macvlanConfig != { }) ''
[MACVLAN]
${attrsToSection def.macvlanConfig}
''
+ optionalString (def.vxlanConfig != { }) ''
[VXLAN]
${attrsToSection def.vxlanConfig}
''
+ optionalString (def.geneveConfig != { }) ''
[GENEVE]
${attrsToSection def.geneveConfig}
''
+ optionalString (def.hsrConfig != { }) ''
[HSR]
${attrsToSection def.hsrConfig}
''
+ optionalString (def.bareUDPConfig != { }) ''
[BareUDP]
${attrsToSection def.bareUDPConfig}
''
+ optionalString (def.l2tpConfig != { }) ''
[L2TP]
${attrsToSection def.l2tpConfig}
''
+ flip concatMapStrings def.l2tpSessions (x: ''
[L2TPSession]
${attrsToSection x}
'')
+ optionalString (def.macsecConfig != { }) ''
[MACsec]
${attrsToSection def.macsecConfig}
''
+ optionalString (def.macsecConfig != { }) ''
[MACsec]
${attrsToSection def.macsecConfig}
''
+ flip concatMapStrings def.macsecReceiveChannels (x: ''
[MACsecReceiveChannel]
${attrsToSection x}
'')
+ flip concatMapStrings def.macsecTransmitAssociations (x: ''
[MACsecTransmitAssociation]
${attrsToSection x}
'')
+ flip concatMapStrings def.macsecReceiveAssociations (x: ''
[MACsecReceiveAssociation]
${attrsToSection x}
'')
+ optionalString (def.tunnelConfig != { }) ''
[Tunnel]
${attrsToSection def.tunnelConfig}
@@ -69,6 +113,10 @@ in
[Peer]
${attrsToSection def.peerConfig}
''
+ optionalString (def.vxcanConfig != { }) ''
[VXCAN]
${attrsToSection def.vxcanConfig}
''
+ optionalString (def.tunConfig != { }) ''
[Tun]
${attrsToSection def.tunConfig}
@@ -77,14 +125,6 @@ in
[Tap]
${attrsToSection def.tapConfig}
''
+ optionalString (def.l2tpConfig != { }) ''
[L2TP]
${attrsToSection def.l2tpConfig}
''
+ flip concatMapStrings def.l2tpSessions (x: ''
[L2TPSession]
${attrsToSection x}
'')
+ optionalString (def.wireguardConfig != { }) ''
[WireGuard]
${attrsToSection def.wireguardConfig}
@@ -105,14 +145,18 @@ in
[VRF]
${attrsToSection def.vrfConfig}
''
+ optionalString (def.wlanConfig != { }) ''
[WLAN]
${attrsToSection def.wlanConfig}
''
+ optionalString (def.batmanAdvancedConfig != { }) ''
[BatmanAdvanced]
${attrsToSection def.batmanAdvancedConfig}
''
+ optionalString (def.ipoibConfig != { }) ''
[IPoIB]
${attrsToSection def.ipoibConfig}
''
+ optionalString (def.wlanConfig != { }) ''
[WLAN]
${attrsToSection def.wlanConfig}
''
+ def.extraConfig;
networkToUnit =
@@ -122,6 +166,10 @@ in
[Link]
${attrsToSection def.linkConfig}
''
+ optionalString (def.sriovConfig != { }) ''
[SR-IOV]
${attrsToSection def.sriovConfig}
''
+ ''
[Network]
''
@@ -147,9 +195,6 @@ in
+ optionalString (def.vrf != [ ]) ''
${concatStringsSep "\n" (map (s: "VRF=${s}") def.vrf)}
''
+ optionalString (def.vlan != [ ]) ''
${concatStringsSep "\n" (map (s: "VLAN=${s}") def.vlan)}
''
+ optionalString (def.macvlan != [ ]) ''
${concatStringsSep "\n" (map (s: "MACVLAN=${s}") def.macvlan)}
''
@@ -159,12 +204,15 @@ in
+ optionalString (def.macvtap != [ ]) ''
${concatStringsSep "\n" (map (s: "MACVTAP=${s}") def.macvtap)}
''
+ optionalString (def.vxlan != [ ]) ''
${concatStringsSep "\n" (map (s: "VXLAN=${s}") def.vxlan)}
''
+ optionalString (def.tunnel != [ ]) ''
${concatStringsSep "\n" (map (s: "Tunnel=${s}") def.tunnel)}
''
+ optionalString (def.vlan != [ ]) ''
${concatStringsSep "\n" (map (s: "VLAN=${s}") def.vlan)}
''
+ optionalString (def.vxlan != [ ]) ''
${concatStringsSep "\n" (map (s: "VXLAN=${s}") def.vxlan)}
''
+ optionalString (def.xfrm != [ ]) ''
${concatStringsSep "\n" (map (s: "Xfrm=${s}") def.xfrm)}
''
@@ -173,10 +221,22 @@ in
[Address]
${attrsToSection x}
'')
+ flip concatMapStrings def.neighbors (x: ''
[Neighbor]
${attrsToSection x}
'')
+ flip concatMapStrings def.ipv6AddressLabels (x: ''
[IPv6AddressLabel]
${attrsToSection x}
'')
+ flip concatMapStrings def.routingPolicyRules (x: ''
[RoutingPolicyRule]
${attrsToSection x}
'')
+ flip concatMapStrings def.nextHops (x: ''
[NextHop]
${attrsToSection x}
'')
+ flip concatMapStrings def.routes (x: ''
[Route]
${attrsToSection x}
@@ -201,14 +261,14 @@ in
[DHCPServer]
${attrsToSection def.dhcpServerConfig}
''
+ flip concatMapStrings def.dhcpServerStaticLeases (x: ''
[DHCPServerStaticLease]
${attrsToSection x}
'')
+ optionalString (def.ipv6SendRAConfig != { }) ''
[IPv6SendRA]
${attrsToSection def.ipv6SendRAConfig}
''
+ flip concatMapStrings def.ipv6PREF64Prefixes (x: ''
[IPv6PREF64Prefix]
${attrsToSection x}
'')
+ flip concatMapStrings def.ipv6Prefixes (x: ''
[IPv6Prefix]
${attrsToSection x}
@@ -217,8 +277,8 @@ in
[IPv6RoutePrefix]
${attrsToSection x}
'')
+ flip concatMapStrings def.dhcpServerStaticLeases (x: ''
[DHCPServerStaticLease]
+ flip concatMapStrings def.ipv6PREF64Prefixes (x: ''
[IPv6PREF64Prefix]
${attrsToSection x}
'')
+ optionalString (def.bridgeConfig != { }) ''
@@ -333,6 +393,14 @@ in
[HierarchyTokenBucketClass]
${attrsToSection def.hierarchyTokenBucketClassConfig}
''
+ optionalString (def.classfulMultiQueueingConfig != { }) ''
[ClassfulMultiQueueing]
${attrsToSection def.classfulMultiQueueingConfig}
''
+ optionalString (def.bandMultiQueueingConfig != { }) ''
[BandMultiQueueing]
${attrsToSection def.bandMultiQueueingConfig}
''
+ optionalString (def.heavyHitterFilterConfig != { }) ''
[HeavyHitterFilter]
${attrsToSection def.heavyHitterFilterConfig}
File diff suppressed because it is too large Load Diff