default.nix (1155B)
1 ## VLAN 2 ## ==== 3 ## 4 ## Virtual LANs give you the ability to sub-divide a LAN. Linux can 5 ## accept VLAN tagged traffic and presents each VLAN ID as a 6 ## different network interface (eg: eth0.100 for VLAN ID 100) 7 ## 8 ## Some Liminix devices with multiple ethernet ports are implemented 9 ## using a network switch connecting the physical ports to the CPU, 10 ## and require using VLAN in order to send different traffic to 11 ## different ports (e.g. LAN vs WAN) 12 13 { lib, pkgs, config, ...}: 14 let 15 inherit (lib) mkOption types; 16 inherit (pkgs.liminix.services) oneshot; 17 inherit (pkgs) liminix; 18 in 19 { 20 options = { 21 system.service.vlan = mkOption { type = liminix.lib.types.serviceDefn; }; 22 }; 23 config.system.service.vlan = liminix.callService ./service.nix { 24 ifname = mkOption { 25 type = types.str; 26 description = "interface name to create"; 27 }; 28 primary = mkOption { 29 description = "existing physical interface"; 30 type = liminix.lib.types.interface; 31 }; 32 vid = mkOption { 33 description = "VLAN identifier (VID) in range 1-4094"; 34 type = types.str; 35 }; 36 }; 37 config.kernel.config = { 38 VLAN_8021Q = "y"; 39 }; 40 }