2023-08-07 22:43:12 +02:00
|
|
|
## Bridge module
|
|
|
|
##
|
|
|
|
## 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
|
|
|
|
## on the same network. Create a ``primary`` service to specify the
|
|
|
|
## new device, and a ``members`` service to add constituent devices
|
|
|
|
## to it.
|
|
|
|
|
|
|
|
|
2023-07-20 12:46:19 +02:00
|
|
|
{ lib, pkgs, config, ...}:
|
|
|
|
let
|
|
|
|
inherit (lib) mkOption types;
|
|
|
|
inherit (pkgs.liminix.services) oneshot;
|
2023-08-05 15:08:02 +02:00
|
|
|
inherit (pkgs) liminix;
|
2023-07-20 12:46:19 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
system.service.bridge = {
|
|
|
|
primary = mkOption {
|
2023-08-05 15:08:02 +02:00
|
|
|
type = liminix.lib.types.serviceDefn;
|
2023-07-20 12:46:19 +02:00
|
|
|
};
|
|
|
|
members = mkOption {
|
2023-08-05 15:08:02 +02:00
|
|
|
type = liminix.lib.types.serviceDefn;
|
2023-07-20 12:46:19 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-08-05 15:08:02 +02:00
|
|
|
config.system.service.bridge = {
|
|
|
|
primary = liminix.callService ./primary.nix {
|
|
|
|
ifname = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
description = "interface name for the bridge device";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
members = liminix.callService ./members.nix {
|
|
|
|
members = mkOption {
|
|
|
|
type = types.listOf liminix.lib.types.service;
|
|
|
|
description = "interfaces to add to the bridge";
|
|
|
|
};
|
|
|
|
primary = mkOption {
|
|
|
|
type = liminix.lib.types.service;
|
|
|
|
description = "bridge interface to add them to";
|
|
|
|
};
|
|
|
|
};
|
2023-07-20 12:46:19 +02:00
|
|
|
};
|
2023-08-05 15:08:02 +02:00
|
|
|
config.kernel.config.BRIDGE = "y";
|
2023-07-20 12:46:19 +02:00
|
|
|
}
|