liminix/modules/bridge/default.nix

48 lines
1.2 KiB
Nix
Raw Normal View History

2023-08-07 20:43:12 +00:00
## Bridge module
## =============
2023-08-07 20:43:12 +00:00
##
## Allows creation of Layer 2 software "bridge" network devices. A
## common use case is to merge together a hardware Ethernet device
## with one or more WLANs so that several local devices appear to be
2023-08-18 22:58:06 +00:00
## on the same network.
2023-08-07 20:43:12 +00:00
{ lib, pkgs, config, ...}:
let
inherit (lib) mkOption types;
inherit (pkgs.liminix.services) oneshot;
2023-08-05 13:08:02 +00:00
inherit (pkgs) liminix;
in
{
options = {
system.service.bridge = {
primary = mkOption { type = liminix.lib.types.serviceDefn; };
members = mkOption { type = liminix.lib.types.serviceDefn; };
};
};
config.system.service.bridge = {
primary = liminix.callService ./primary.nix {
2023-08-16 18:44:00 +00:00
ifname = mkOption {
type = types.str;
description = "bridge interface name to create";
2023-08-05 13:08:02 +00:00
};
};
members = liminix.callService ./members.nix {
primary = mkOption {
type = liminix.lib.types.interface;
description = "primary bridge interface";
};
members = mkOption {
type = types.listOf liminix.lib.types.interface;
description = "interfaces to add to the bridge";
};
};
};
config.kernel.config = {
BRIDGE = "y";
BRIDGE_VLAN_FILTERING = "y";
BRIDGE_IGMP_SNOOPING = "y";
};
}