nixos/network-interfaces-systemd: add bridge interfaces in systemd-initrd
This commit is contained in:
parent
a3211ceb47
commit
1f34babe84
1 changed files with 17 additions and 13 deletions
|
@ -173,6 +173,20 @@ let
|
|||
}];
|
||||
}));
|
||||
|
||||
bridgeNetworks = mkMerge (flip mapAttrsToList cfg.bridges (name: bridge: {
|
||||
netdevs."40-${name}" = {
|
||||
netdevConfig = {
|
||||
Name = name;
|
||||
Kind = "bridge";
|
||||
};
|
||||
};
|
||||
networks = listToAttrs (forEach bridge.interfaces (bi:
|
||||
nameValuePair "40-${bi}" (mkMerge [ (genericNetwork (mkOverride 999)) {
|
||||
DHCP = mkOverride 0 (dhcpStr false);
|
||||
networkConfig.Bridge = name;
|
||||
} ])));
|
||||
}));
|
||||
|
||||
vlanNetworks = mkMerge (flip mapAttrsToList cfg.vlans (name: vlan: {
|
||||
netdevs."40-${name}" = {
|
||||
netdevConfig = {
|
||||
|
@ -198,9 +212,11 @@ in
|
|||
boot.initrd.systemd.network = mkMerge [
|
||||
(genericDhcpNetworks true)
|
||||
interfaceNetworks
|
||||
bridgeNetworks
|
||||
vlanNetworks
|
||||
];
|
||||
boot.initrd.availableKernelModules =
|
||||
optional (cfg.bridges != {}) "bridge" ++
|
||||
optional (cfg.vlans != {}) "8021q";
|
||||
})
|
||||
|
||||
|
@ -231,19 +247,7 @@ in
|
|||
}
|
||||
(genericDhcpNetworks false)
|
||||
interfaceNetworks
|
||||
(mkMerge (flip mapAttrsToList cfg.bridges (name: bridge: {
|
||||
netdevs."40-${name}" = {
|
||||
netdevConfig = {
|
||||
Name = name;
|
||||
Kind = "bridge";
|
||||
};
|
||||
};
|
||||
networks = listToAttrs (forEach bridge.interfaces (bi:
|
||||
nameValuePair "40-${bi}" (mkMerge [ (genericNetwork (mkOverride 999)) {
|
||||
DHCP = mkOverride 0 (dhcpStr false);
|
||||
networkConfig.Bridge = name;
|
||||
} ])));
|
||||
})))
|
||||
bridgeNetworks
|
||||
(mkMerge (flip mapAttrsToList cfg.bonds (name: bond: {
|
||||
netdevs."40-${name}" = {
|
||||
netdevConfig = {
|
||||
|
|
Loading…
Reference in a new issue