Compare commits
8 commits
main
...
mdebray/us
Author | SHA1 | Date | |
---|---|---|---|
|
420b1764c5 | ||
|
279f678b0c | ||
|
36499bdb06 | ||
|
5f3c299228 | ||
|
27635fbe92 | ||
|
be143d1a13 | ||
|
31d31260b8 | ||
|
b129f775b2 |
14 changed files with 320 additions and 201 deletions
|
@ -135,6 +135,21 @@ rec {
|
|||
../../modules/zyxel-dual-image
|
||||
];
|
||||
|
||||
options = {
|
||||
hardware.wlanMacAddresses = {
|
||||
wlan0 = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Mac address of wlan0 device";
|
||||
};
|
||||
wlan1 = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Mac address of wlan1 device";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
|
||||
nixpkgs.hostPlatform = system.crossSystem;
|
||||
|
||||
filesystem = dir {
|
||||
|
@ -208,10 +223,12 @@ rec {
|
|||
wlan0 = link.build {
|
||||
ifname = "wlan0";
|
||||
dependencies = [ mac80211 ];
|
||||
mac = config.hardware.wlanMacAddresses.wlan0;
|
||||
};
|
||||
wlan1 = link.build {
|
||||
ifname = "wlan1";
|
||||
dependencies = [ mac80211 ];
|
||||
mac = config.hardware.wlanMacAddresses.wlan1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -364,4 +381,5 @@ rec {
|
|||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -87,6 +87,8 @@ in rec {
|
|||
];
|
||||
};
|
||||
|
||||
services.usteer = svc.usteer.build { interface = services.int; };
|
||||
|
||||
services.dhcpv4 =
|
||||
let iface = services.int;
|
||||
in svc.network.dhcp.client.build { interface = iface; };
|
||||
|
|
|
@ -74,6 +74,13 @@ in {
|
|||
device will be renamed to the name provided.
|
||||
'';
|
||||
};
|
||||
mac = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
MAC address of the interface.
|
||||
'';
|
||||
};
|
||||
devpath = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
{
|
||||
ifname
|
||||
, devpath ? null
|
||||
, mac ? null
|
||||
, mtu} :
|
||||
# if devpath is supplied, we rename the interface at that
|
||||
# path to have the specified name.
|
||||
|
@ -24,7 +25,7 @@ in oneshot {
|
|||
inherit name;
|
||||
up = ''
|
||||
${rename}
|
||||
${liminix.networking.ifup name ifname}
|
||||
${liminix.networking.ifup name ifname mac}
|
||||
'';
|
||||
down = "ip link set down dev ${ifname}";
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ in
|
|||
mv out $out
|
||||
'';
|
||||
systemConfiguration =
|
||||
pkgs.systemconfig config.filesystem.contents;
|
||||
pkgs.systemconfig config.filesystem.contents config.hostname;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
26
modules/usteer/default.nix
Normal file
26
modules/usteer/default.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
## usteer
|
||||
## ==============
|
||||
##
|
||||
## usteer is a band-steering daemon for hostapd.
|
||||
## this helps you optimize the roaming behavior of wireless clients (STAs) in an ESS
|
||||
## consisting of multiple BSS / APs.
|
||||
## you want this as soon as you are deploying Liminix on >1 APs that are close to each other.
|
||||
{ lib, pkgs, ... }:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
inherit (pkgs) liminix;
|
||||
in {
|
||||
options.system.service.usteer = mkOption {
|
||||
type = liminix.lib.types.serviceDefn;
|
||||
};
|
||||
|
||||
config = {
|
||||
system.service.usteer = pkgs.liminix.callService ./usteer.nix {
|
||||
ifname = mkOption {
|
||||
type = types.str;
|
||||
description = "interface name on which to connect to other usteer instances";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
18
modules/usteer/usteer.nix
Normal file
18
modules/usteer/usteer.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
liminix
|
||||
, lib
|
||||
, usteer
|
||||
}:
|
||||
{ ifname }:
|
||||
let
|
||||
inherit (liminix.services) longrun;
|
||||
name = "usteerd";
|
||||
in
|
||||
longrun {
|
||||
# Does it need to be unique?
|
||||
inherit name;
|
||||
run = ''
|
||||
mkdir -p /run/usteerd
|
||||
${usteer}/bin/usteerd -s -vvvv -i ${ifname}
|
||||
'';
|
||||
}
|
|
@ -11,7 +11,7 @@ in oneshot rec {
|
|||
up = ''
|
||||
ip link add link $(output ${primary} ifname) name ${ifname} type vlan id ${vid}
|
||||
${optionalString untagged.egress "bridge vlan add dev ${ifname} vid ${toString untagged.vid} pvid untagged master"}
|
||||
${liminix.networking.ifup name ifname}
|
||||
${liminix.networking.ifup name ifname null}
|
||||
(in_outputs ${name}
|
||||
echo ${ifname} > ifname
|
||||
)
|
||||
|
|
|
@ -118,6 +118,7 @@ extraPkgs // {
|
|||
hostapd =
|
||||
let
|
||||
config = [
|
||||
"CONFIG_WNM=y"
|
||||
"CONFIG_DRIVER_NL80211=y"
|
||||
"CONFIG_IAPP=y"
|
||||
"CONFIG_IEEE80211AC=y"
|
||||
|
@ -157,6 +158,7 @@ extraPkgs // {
|
|||
hostapd-radius =
|
||||
let
|
||||
config = [
|
||||
"CONFIG_WNM=y"
|
||||
"CONFIG_DRIVER_NL80211=y"
|
||||
"CONFIG_DRIVER_WIRED=y"
|
||||
"CONFIG_EAP=y"
|
||||
|
|
|
@ -113,6 +113,7 @@ in {
|
|||
libubox = callPackage ./libubox {};
|
||||
ubus = callPackage ./ubus {};
|
||||
iwinfo = callPackage ./iwinfo {};
|
||||
usteer = callPackage ./usteer {};
|
||||
uevent-watch = callPackage ./uevent-watch {};
|
||||
usb-modeswitch = callPackage ./usb-modeswitch {};
|
||||
writeAshScript = callPackage ./write-ash-script {};
|
||||
|
|
|
@ -74,7 +74,7 @@ let
|
|||
../../modules/s6
|
||||
];
|
||||
};
|
||||
in systemconfig eval.config.filesystem.contents;
|
||||
in systemconfig eval.config.filesystem.contents eval.config.hostname;
|
||||
in writeScriptBin "levitate" ''
|
||||
#!/bin/sh
|
||||
destdir=${newRoot}
|
||||
|
|
|
@ -3,9 +3,13 @@
|
|||
, serviceFns
|
||||
}:
|
||||
{
|
||||
ifup = name : ifname : ''
|
||||
ifup = name : ifname : mac: ''
|
||||
. ${serviceFns}
|
||||
${ifwait}/bin/ifwait -v ${ifname} present
|
||||
${if (mac == null) then "" else ''
|
||||
ip link set down dev ${ifname}
|
||||
ip link set dev ${ifname} address ${mac}
|
||||
''}
|
||||
ip link set up dev ${ifname}
|
||||
(in_outputs ${name}
|
||||
echo ${ifname} > ifname
|
||||
|
|
|
@ -62,10 +62,10 @@ let
|
|||
${(builtins.concatStringsSep "\n" (visit "." attrset))}
|
||||
}
|
||||
'';
|
||||
in attrset:
|
||||
in attrset: hostname:
|
||||
let makedevs = activateScript attrset;
|
||||
in stdenv.mkDerivation {
|
||||
name="make-stuff";
|
||||
name="${hostname}-system-configuration";
|
||||
src = ./.;
|
||||
|
||||
CFLAGS = "-Os";
|
||||
|
|
40
pkgs/usteer/default.nix
Normal file
40
pkgs/usteer/default.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchgit,
|
||||
cmake,
|
||||
json_c,
|
||||
libpcap,
|
||||
libubox,
|
||||
ubus,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "usteer";
|
||||
version = "unstable-04-09-2024";
|
||||
|
||||
src = fetchgit {
|
||||
url = "https://git.dgnum.eu/DGNum/usteer.git";
|
||||
rev = "50a6d2dd35f379d2555a3110ba72b4134c1a6a40";
|
||||
hash = "sha256-fKVAockgLjUs0H91tX1bG02DmVff5EglOlXOmjJPwM8=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace CMakeLists.txt \
|
||||
--replace-fail "/usr" "${placeholder "out"}"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
];
|
||||
|
||||
buildInputs = [ ubus libpcap libubox json_c ];
|
||||
|
||||
meta = {
|
||||
description = "";
|
||||
homepage = "https://github.com/openwrt/usteer";
|
||||
maintainers = with lib.maintainers; [ raitobezarius ];
|
||||
mainProgram = "usteer";
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue