liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

default.nix (1351B)


      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. Create a ``primary`` service to specify the
      8 ##  new device, and a ``members`` service to add constituent devices
      9 ##  to it.
     10 
     11 
     12 { lib, pkgs, config, ...}:
     13 let
     14   inherit (lib) mkOption types;
     15   inherit (pkgs.liminix.services) oneshot;
     16   inherit (pkgs) liminix;
     17 in
     18 {
     19   options = {
     20     system.service.bridge = {
     21       primary = mkOption {
     22         type = liminix.lib.types.serviceDefn;
     23       };
     24       members = mkOption {
     25         type = liminix.lib.types.serviceDefn;
     26       };
     27     };
     28   };
     29   config.system.service.bridge = {
     30     primary = liminix.callService ./primary.nix {
     31       ifname = mkOption {
     32         type = types.str;
     33         description = "interface name for the bridge device";
     34       };
     35     };
     36     members = liminix.callService ./members.nix {
     37       members = mkOption {
     38         type = types.listOf liminix.lib.types.service;
     39         description = "interfaces to add to the bridge";
     40       };
     41       primary = mkOption {
     42         type = liminix.lib.types.service;
     43         description = "bridge interface to add them to";
     44       };
     45     };
     46   };
     47   config.kernel.config.BRIDGE = "y";
     48 }