File tree 1 file changed +30
-0
lines changed
nixos/modules/system/boot
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 142
142
( assertValueOneOf "EmitTimezone" boolValues )
143
143
] ;
144
144
145
+ # .network files have a [Link] section with different options than in .netlink files
146
+ checkNetworkLink = checkUnitConfig "Link" [
147
+ ( assertOnlyFields [
148
+ "MACAddress" "MTUBytes" "ARP" "Unmanaged"
149
+ ] )
150
+ ( assertMacAddress "MACAddress" )
151
+ ( assertByteFormat "MTUBytes" )
152
+ ( assertValueOneOf "ARP" boolValues )
153
+ ( assertValueOneOf "Unmanaged" boolValues )
154
+ ] ;
155
+
156
+
145
157
commonNetworkOptions = {
146
158
147
159
enable = mkOption {
371
383
'' ;
372
384
} ;
373
385
386
+ linkConfig = mkOption {
387
+ default = { } ;
388
+ example = { Unmanaged = true ; } ;
389
+ type = types . addCheck ( types . attrsOf unitOption ) checkNetworkLink ;
390
+ description = ''
391
+ Each attribute in this set specifies an option in the
392
+ <literal>[Link]</literal> section of the unit. See
393
+ <citerefentry><refentrytitle>systemd.network</refentrytitle>
394
+ <manvolnum>5</manvolnum></citerefentry> for details.
395
+ '' ;
396
+ } ;
397
+
374
398
name = mkOption {
375
399
type = types . nullOr types . str ;
376
400
default = null ;
581
605
{ inherit ( def ) enable ;
582
606
text = commonMatchText def +
583
607
''
608
+ ${ optionalString ( def . linkConfig != { } ) ''
609
+ [Link]
610
+ ${ attrsToSection def . linkConfig }
611
+
612
+ '' }
613
+
584
614
[Network]
585
615
${ attrsToSection def . networkConfig }
586
616
${ concatStringsSep "\n " ( map ( s : "Address=${ s } " ) def . address ) }
You can’t perform that action at this time.
0 commit comments