liminix-fork/modules/vlan/service.nix
Daniel Barlow 333327be75 make a module for vlan
Acked-by: Daniel Barlow <<dan@telent.net>>
2023-08-30 23:26:44 +01:00

15 lines
322 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}
'';
down = "ip link set down dev ${ifname}";
}