nixos/systemd-networkd: add new options for v260

systemd 260 introduces some new linkConfig options to configure ethernet
devices and a new [MobileNetwork] section (and options) to configure
cellular network connections using a new integration with ModemManager.

- https://github.com/systemd/systemd/releases/tag/v260
This commit is contained in:
x7c2d
2026-04-25 23:06:57 +00:00
parent b6db88c463
commit 12f553550f
2 changed files with 62 additions and 0 deletions
+4
View File
@@ -413,6 +413,10 @@ in
[QuickFairQueueingClass]
${attrsToSection def.quickFairQueueingConfigClass}
''
+ optionalString (def.mobileNetworkConfig != { }) ''
[MobileNetwork]
${attrsToSection def.mobileNetworkConfig}
''
+ flip concatMapStrings def.bridgeVLANs (x: ''
[BridgeVLAN]
${attrsToSection x}
+58
View File
@@ -180,6 +180,12 @@ let
"StatisticsBlockCoalesceSec"
"MDI"
"SR-IOVVirtualFunctions"
"ScatterGather"
"ScatterGatherFragmentList"
"TCPECNSegmentationOffload"
"TCPMangleIdSegmentationOffload"
"GenericReceiveOffloadList"
"GenericReceiveOffloadUDPForwarding"
])
(assertValueOneOf "MACAddressPolicy" [
"persistent"
@@ -271,6 +277,12 @@ let
"auto"
])
(assertRange "SR-IOVVirtualFunctions" 0 2147483647)
(assertValueOneOf "ScatterGather" boolValues)
(assertValueOneOf "ScatterGatherFragmentList" boolValues)
(assertValueOneOf "TCPECNSegmentationOffload" boolValues)
(assertValueOneOf "TCPMangleIdSegmentationOffload" boolValues)
(assertValueOneOf "GenericReceiveOffloadList" boolValues)
(assertValueOneOf "GenericReceiveOffloadUDPForwarding" boolValues)
];
sectionSR-IOV = checkUnitConfig "SR-IOV" [
@@ -2413,6 +2425,38 @@ let
(assertInt "PVID")
(assertRange "PVID" 0 4094)
];
sectionMobileNetwork = checkUnitConfig "MobileNetwork" [
(assertOnlyFields [
"APN"
"AllowedAuthenticationMechanisms"
"User"
"Password"
"IPFamily"
"AllowRoaming"
"PIN"
"OperatorId"
"RouteMetric"
"UseGateway"
])
(assertValuesSomeOfOr "AllowedAuthenticationMechanisms" [
"none"
"pap"
"chap"
"mschap"
"mschapv2"
"eap"
] "")
(assertValueOneOf "IPFamily" [
"ipv4"
"ipv6"
"both"
"any"
])
(assertValueOneOf "AllowRoaming" boolValues)
(assertRange "RouteMetric" 0 4294967295)
(assertValueOneOf "UseGateway" boolValues)
];
};
};
@@ -3747,6 +3791,20 @@ let
'';
};
mobileNetworkConfig = mkOption {
default = { };
example = {
APN = "access-point-name";
AllowRoaming = false;
};
type = types.addCheck (types.attrsOf unitOption) check.network.sectionMobileNetwork;
description = ''
Each attribute in this set specifies an option in the
`[MobileNetwork]` section of the unit. See
{manpage}`systemd.network(5)` for details.
'';
};
name = mkOption {
type = types.nullOr types.str;
default = null;