forked from DGNum/liminix
merge bridge services into one
This commit is contained in:
parent
a019e59a80
commit
6f92f8fa8b
5 changed files with 23 additions and 45 deletions
|
@ -17,30 +17,19 @@ let
|
|||
in
|
||||
{
|
||||
options = {
|
||||
system.service.bridge = {
|
||||
primary = mkOption {
|
||||
type = liminix.lib.types.serviceDefn;
|
||||
};
|
||||
members = mkOption {
|
||||
type = liminix.lib.types.serviceDefn;
|
||||
};
|
||||
system.service.bridge = mkOption {
|
||||
type = liminix.lib.types.serviceDefn;
|
||||
};
|
||||
};
|
||||
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 {
|
||||
config.system.service = {
|
||||
bridge = liminix.callService ./service.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";
|
||||
ifname = mkOption {
|
||||
type = types.str;
|
||||
description = "bridge interface name to create";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
liminix
|
||||
, lib
|
||||
}:
|
||||
{ ifname } :
|
||||
let
|
||||
inherit (liminix.networking) interface;
|
||||
inherit (liminix.lib) typeChecked;
|
||||
inherit (lib) mkOption types;
|
||||
in interface {
|
||||
device = ifname;
|
||||
type = "bridge";
|
||||
}
|
|
@ -3,11 +3,15 @@
|
|||
, ifwait
|
||||
, lib
|
||||
}:
|
||||
{ members, primary } :
|
||||
{ members, ifname } :
|
||||
let
|
||||
inherit (liminix.networking) interface;
|
||||
inherit (liminix.services) bundle oneshot;
|
||||
inherit (lib) mkOption types;
|
||||
primary = interface {
|
||||
device = ifname;
|
||||
type = "bridge";
|
||||
};
|
||||
addif = member :
|
||||
oneshot {
|
||||
name = "add-${member.device}-to-br-${primary.device}";
|
||||
|
@ -15,7 +19,8 @@ let
|
|||
down = "ip link set dev ${member.device} nomaster";
|
||||
dependencies = [ primary member ];
|
||||
};
|
||||
in bundle {
|
||||
|
||||
in (bundle {
|
||||
name = "bridge-${primary.device}-members";
|
||||
contents = map addif members;
|
||||
}
|
||||
contents = [ primary ] ++ map addif members;
|
||||
}) // { device = primary.device; }
|
Loading…
Add table
Add a link
Reference in a new issue