diff options
author | apfelkuchen06 <apfelkuchen@hrnz.li> | 2023-02-28 00:06:39 +0100 |
---|---|---|
committer | apfelkuchen06 <apfelkuchen@hrnz.li> | 2023-03-16 03:28:20 +0100 |
commit | 28ddd570f70dd9fe160260672ebf687abc5f2585 (patch) | |
tree | 3f9314ebb4e0b7777a79e2edc5d01125b0390f5e /nixos/modules/system/boot/networkd.nix | |
parent | 590ccae1f848eef59f8984e98348208eb69cffe1 (diff) | |
download | nixpkgs-28ddd570f70dd9fe160260672ebf687abc5f2585.tar nixpkgs-28ddd570f70dd9fe160260672ebf687abc5f2585.tar.gz nixpkgs-28ddd570f70dd9fe160260672ebf687abc5f2585.tar.bz2 nixpkgs-28ddd570f70dd9fe160260672ebf687abc5f2585.tar.lz nixpkgs-28ddd570f70dd9fe160260672ebf687abc5f2585.tar.xz nixpkgs-28ddd570f70dd9fe160260672ebf687abc5f2585.tar.zst nixpkgs-28ddd570f70dd9fe160260672ebf687abc5f2585.zip |
nixos/networkd: add Bridge options
Diffstat (limited to 'nixos/modules/system/boot/networkd.nix')
-rw-r--r-- | nixos/modules/system/boot/networkd.nix | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index b13e79b5951..7bebe3e2811 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -960,6 +960,42 @@ let (assertMacAddress "MACAddress") ]; + sectionBridge = checkUnitConfig "Bridge" [ + (assertOnlyFields [ + "UnicastFlood" + "MulticastFlood" + "MulticastToUnicast" + "NeighborSuppression" + "Learning" + "Hairpin" + "Isolated" + "UseBPDU" + "FastLeave" + "AllowPortToBeRoot" + "ProxyARP" + "ProxyARPWiFi" + "MulticastRouter" + "Cost" + "Priority" + ]) + (assertValueOneOf "UnicastFlood" boolValues) + (assertValueOneOf "MulticastFlood" boolValues) + (assertValueOneOf "MulticastToUnicast" boolValues) + (assertValueOneOf "NeighborSuppression" boolValues) + (assertValueOneOf "Learning" boolValues) + (assertValueOneOf "Hairpin" boolValues) + (assertValueOneOf "Isolated" boolValues) + (assertValueOneOf "UseBPDU" boolValues) + (assertValueOneOf "FastLeave" boolValues) + (assertValueOneOf "AllowPortToBeRoot" boolValues) + (assertValueOneOf "ProxyARP" boolValues) + (assertValueOneOf "ProxyARPWiFi" boolValues) + (assertValueOneOf "MulticastRouter" [ "no" "query" "permanent" "temporary" ]) + (assertInt "Cost") + (assertRange "Cost" 1 65535) + (assertInt "Priority") + (assertRange "Priority" 0 63) + ]; }; }; @@ -1534,6 +1570,17 @@ let ''; }; + bridgeConfig = mkOption { + default = {}; + example = { MulticastFlood = false; Cost = 20; }; + type = types.addCheck (types.attrsOf unitOption) check.network.sectionBridge; + description = lib.mdDoc '' + Each attribute in this set specifies an option in the + `[Bridge]` section of the unit. See + {manpage}`systemd.network(5)` for details. + ''; + }; + name = mkOption { type = types.nullOr types.str; default = null; @@ -1941,6 +1988,10 @@ let [DHCPServerStaticLease] ${attrsToSection x.dhcpServerStaticLeaseConfig} '') + + optionalString (def.bridgeConfig != { }) '' + [Bridge] + ${attrsToSection def.bridgeConfig} + '' + def.extraConfig; }; |