mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 21:25:30 +03:00
nixos/network-interfaces-systemd: add VLAN interfaces in systemd-initrd
This commit is contained in:
parent
1f845ebc34
commit
2cb4671ebc
1 changed files with 21 additions and 13 deletions
|
@ -173,6 +173,19 @@ let
|
||||||
}];
|
}];
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
vlanNetworks = mkMerge (flip mapAttrsToList cfg.vlans (name: vlan: {
|
||||||
|
netdevs."40-${name}" = {
|
||||||
|
netdevConfig = {
|
||||||
|
Name = name;
|
||||||
|
Kind = "vlan";
|
||||||
|
};
|
||||||
|
vlanConfig.Id = vlan.id;
|
||||||
|
};
|
||||||
|
networks."40-${vlan.interface}" = (mkMerge [ (genericNetwork (mkOverride 999)) {
|
||||||
|
vlan = [ name ];
|
||||||
|
} ]);
|
||||||
|
}));
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -182,7 +195,13 @@ in
|
||||||
# Note this is if initrd.network.enable, not if
|
# Note this is if initrd.network.enable, not if
|
||||||
# initrd.systemd.network.enable. By setting the latter and not the
|
# initrd.systemd.network.enable. By setting the latter and not the
|
||||||
# former, the user retains full control over the configuration.
|
# former, the user retains full control over the configuration.
|
||||||
boot.initrd.systemd.network = mkMerge [(genericDhcpNetworks true) interfaceNetworks];
|
boot.initrd.systemd.network = mkMerge [
|
||||||
|
(genericDhcpNetworks true)
|
||||||
|
interfaceNetworks
|
||||||
|
vlanNetworks
|
||||||
|
];
|
||||||
|
boot.initrd.availableKernelModules =
|
||||||
|
optional (cfg.vlans != {}) "8021q";
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.useNetworkd {
|
(mkIf cfg.useNetworkd {
|
||||||
|
@ -377,18 +396,7 @@ in
|
||||||
} ]);
|
} ]);
|
||||||
};
|
};
|
||||||
})))
|
})))
|
||||||
(mkMerge (flip mapAttrsToList cfg.vlans (name: vlan: {
|
vlanNetworks
|
||||||
netdevs."40-${name}" = {
|
|
||||||
netdevConfig = {
|
|
||||||
Name = name;
|
|
||||||
Kind = "vlan";
|
|
||||||
};
|
|
||||||
vlanConfig.Id = vlan.id;
|
|
||||||
};
|
|
||||||
networks."40-${vlan.interface}" = (mkMerge [ (genericNetwork (mkOverride 999)) {
|
|
||||||
vlan = [ name ];
|
|
||||||
} ]);
|
|
||||||
})))
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# We need to prefill the slaved devices with networking options
|
# We need to prefill the slaved devices with networking options
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue