All checks were successful
build liminix / build_vm_qemu_mips (pull_request) Successful in 35s
build liminix / build_zyxel-nwa50ax_mips (pull_request) Successful in 38s
build liminix / test_shell_customization (pull_request) Successful in 42s
build liminix / test_hostapd (pull_request) Successful in 45s
21 lines
578 B
Nix
21 lines
578 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 ${toString untagged.vid} pvid untagged master"}
|
|
${liminix.networking.ifup name ifname null}
|
|
(in_outputs ${name}
|
|
echo ${ifname} > ifname
|
|
)
|
|
'';
|
|
down = "ip link set down dev ${ifname}";
|
|
dependencies = [ primary ];
|
|
}
|