liminix/modules/vlan/service.nix
2024-04-28 21:33:36 +01:00

19 lines
411 B
Nix

{
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}
(in_outputs ${name}
echo ${ifname} > ifname
)
'';
down = "ip link set down dev ${ifname}";
dependencies = [ primary ];
}