default.nix (1512B)
1 ## Bridge module 2 ## ============= 3 ## 4 ## Allows creation of Layer 2 software "bridge" network devices. A 5 ## common use case is to merge together a hardware Ethernet device 6 ## with one or more WLANs so that several local devices appear to be 7 ## on the same network. 8 9 10 { lib, pkgs, config, ...}: 11 let 12 inherit (lib) mkOption types; 13 inherit (pkgs.liminix.services) oneshot; 14 inherit (pkgs) liminix; 15 in 16 { 17 options = { 18 system.service.bridge = { 19 primary = mkOption { type = liminix.lib.types.serviceDefn; }; 20 members = mkOption { type = liminix.lib.types.serviceDefn; }; 21 }; 22 }; 23 config.system.service.bridge = { 24 primary = liminix.callService ./primary.nix { 25 ifname = mkOption { 26 type = types.str; 27 description = "bridge interface name to create"; 28 }; 29 }; 30 members = liminix.callService ./members.nix { 31 primary = mkOption { 32 type = liminix.lib.types.interface; 33 description = "primary bridge interface"; 34 }; 35 36 members = mkOption { 37 type = types.listOf liminix.lib.types.interface; 38 description = "interfaces to add to the bridge"; 39 }; 40 }; 41 }; 42 config.kernel.config = { 43 BRIDGE = "y"; 44 BRIDGE_IGMP_SNOOPING = "y"; 45 } // lib.optionalAttrs (config.system.service ? vlan) { 46 # depends on bridge _and_ vlan. I would like there to be 47 # a better way to test for the existence of vlan config: 48 # maybe the module should set an `enabled` attribute? 49 BRIDGE_VLAN_FILTERING = "y"; 50 }; 51 }