1
0
liminix/modules/vlan/service.nix

25 lines
419 B
Nix
Raw Normal View History

{
liminix,
lib,
}:
{
ifname,
primary,
vid,
}:
let
inherit (liminix.services) oneshot;
in
oneshot rec {
name = "${ifname}.link";
up = ''
ip link add link $(output ${primary} ifname) name ${ifname} type vlan id ${vid}
${liminix.networking.ifup name ifname}
2023-09-15 20:45:00 +00:00
(in_outputs ${name}
echo ${ifname} > ifname
)
'';
down = "ip link set down dev ${ifname}";
dependencies = [ primary ];
}