2023-08-07 21:43:12 +01:00
|
|
|
## Bridge module
|
2023-08-07 22:14:58 +01:00
|
|
|
## =============
|
2023-08-07 21:43:12 +01: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 23:58:06 +01:00
|
|
|
## on the same network.
|
2023-08-07 21:43:12 +01:00
|
|
|
|
|
|
|
|
2023-07-20 11:46:19 +01:00
|
|
|
{ lib, pkgs, config, ...}:
|
|
|
|
let
|
|
|
|
inherit (lib) mkOption types;
|
|
|
|
inherit (pkgs.liminix.services) oneshot;
|
2023-08-05 14:08:02 +01:00
|
|
|
inherit (pkgs) liminix;
|
2023-07-20 11:46:19 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
2023-08-16 19:44:00 +01:00
|
|
|
system.service.bridge = mkOption {
|
|
|
|
type = liminix.lib.types.serviceDefn;
|
2023-07-20 11:46:19 +01:00
|
|
|
};
|
|
|
|
};
|
2023-08-16 19:44:00 +01:00
|
|
|
config.system.service = {
|
|
|
|
bridge = liminix.callService ./service.nix {
|
2023-08-05 14:08:02 +01:00
|
|
|
members = mkOption {
|
|
|
|
type = types.listOf liminix.lib.types.service;
|
|
|
|
description = "interfaces to add to the bridge";
|
|
|
|
};
|
2023-08-16 19:44:00 +01:00
|
|
|
ifname = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
description = "bridge interface name to create";
|
2023-08-05 14:08:02 +01:00
|
|
|
};
|
|
|
|
};
|
2023-07-20 11:46:19 +01:00
|
|
|
};
|
2023-08-05 14:08:02 +01:00
|
|
|
config.kernel.config.BRIDGE = "y";
|
2023-07-20 11:46:19 +01:00
|
|
|
}
|