2023-08-28 00:45:27 +02:00
|
|
|
{
|
|
|
|
liminix
|
|
|
|
, ifwait
|
|
|
|
, lib
|
|
|
|
}:
|
2024-09-01 14:56:08 +02:00
|
|
|
{ ifname, macAddressFromInterface ? null } :
|
2023-08-28 00:45:27 +02:00
|
|
|
let
|
|
|
|
inherit (liminix.services) bundle oneshot;
|
2024-09-01 14:56:08 +02:00
|
|
|
inherit (lib) mkOption types optional;
|
2023-08-28 00:45:27 +02:00
|
|
|
in oneshot rec {
|
|
|
|
name = "${ifname}.link";
|
|
|
|
up = ''
|
2024-09-01 14:56:08 +02:00
|
|
|
${if macAddressFromInterface == null then
|
|
|
|
"ip link add name ${ifname} type bridge"
|
|
|
|
else
|
|
|
|
"ip link add name ${ifname} address $(output ${macAddressFromInterface} ether) type bridge"}
|
2023-08-28 00:45:27 +02:00
|
|
|
${liminix.networking.ifup name ifname}
|
|
|
|
'';
|
|
|
|
down = "ip link set down dev ${ifname}";
|
2024-09-01 14:56:08 +02:00
|
|
|
|
|
|
|
dependencies = optional (macAddressFromInterface != null) macAddressFromInterface;
|
2023-08-28 00:45:27 +02:00
|
|
|
}
|