2ab144a281
Some checks failed
Should cover egress & ingress. Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
21 lines
555 B
Nix
21 lines
555 B
Nix
{
|
|
liminix
|
|
, lib
|
|
}:
|
|
{ ifname, primary, vid, untagged } :
|
|
let
|
|
inherit (lib) optionalString;
|
|
inherit (liminix.services) oneshot;
|
|
in oneshot rec {
|
|
name = "${ifname}.link";
|
|
up = ''
|
|
ip link add link $(output ${primary} ifname) name ${ifname} type vlan id ${vid}
|
|
${optionalString untagged.egress "bridge vlan add dev ${ifname} vid ${vid} pvid untagged master"}
|
|
${liminix.networking.ifup name ifname}
|
|
(in_outputs ${name}
|
|
echo ${ifname} > ifname
|
|
)
|
|
'';
|
|
down = "ip link set down dev ${ifname}";
|
|
dependencies = [ primary ];
|
|
}
|