Merge pull request 'feat(hostapd): ubus support' (#16) from hostapd-ubus into main

Reviewed-on: DGNum/liminix#16
This commit is contained in:
Ryan Lahfa 2024-09-07 17:53:21 +02:00
commit ce17fea337
3 changed files with 31 additions and 5 deletions

View file

@ -9,5 +9,8 @@ let
in longrun {
# Long term: make it unique so that user can spawn multiple buses if they want.
name = "ubus";
run = "${package}/bin/ubusd";
run = ''
mkdir -p /run/ubus
${package}/bin/ubusd -s /run/ubus/ubus.sock
'';
}

View file

@ -130,9 +130,18 @@ extraPkgs // {
"CONFIG_LIBNL32=y"
"CONFIG_PKCS12=y"
"CONFIG_RSN_PREAUTH=y"
"CONFIG_UBUS=y"
"CONFIG_TLS=internal"
];
h = prev.hostapd.overrideAttrs(o: {
buildInputs = o.buildInputs ++ [ final.libubox final.ubus ];
src = final.fetchFromGitea {
domain = "git.dgnum.eu";
owner = "DGNum";
repo = "hostapd";
rev = "hostap-liminix-integration";
hash = "sha256-qoCXx3raXCD51YX5izj30VG/HMgr6lv/288Yg9I4S7M=";
};
extraConfig = "";
configurePhase = ''
cat > hostapd/defconfig <<EOF
@ -163,10 +172,18 @@ extraPkgs // {
"CONFIG_LIBNL32=y"
"CONFIG_PKCS12=y"
"CONFIG_RSN_PREAUTH=y"
# Required to read the key material for RADIUS.
"CONFIG_TLS=openssl"
"CONFIG_UBUS=y"
"CONFIG_TLS=internal"
];
h = prev.hostapd.overrideAttrs(o: {
buildInputs = o.buildInputs ++ [ final.libubox final.ubus ];
src = final.fetchFromGitea {
domain = "git.dgnum.eu";
owner = "DGNum";
repo = "hostapd";
rev = "hostap-liminix-integration";
hash = "sha256-qoCXx3raXCD51YX5izj30VG/HMgr6lv/288Yg9I4S7M=";
};
extraConfig = "";
configurePhase = ''
cat > hostapd/defconfig <<EOF
@ -175,7 +192,7 @@ extraPkgs // {
${o.configurePhase}
'';
});
in h.override { sqlite = null; };
in h.override { openssl = null; sqlite = null; };

View file

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, cmake, libubox, json_c, lua5_1 }:
{ stdenv, fetchFromGitHub, cmake, libubox, json_c, lua5_1, defaultSocketLocation ? "/run/ubus/ubus.sock" }:
stdenv.mkDerivation {
pname = "ubus";
version = "unstable-04-09-2024";
@ -10,6 +10,12 @@ stdenv.mkDerivation {
hash = "sha256-n82Ub0IiuvWbnlDCoN+0hjo/1PbplEbc56kuOYMrHxQ=";
};
# We don't use /var/run/ in Liminix by default.
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace-fail "/var/run/ubus/ubus.sock" "${defaultSocketLocation}"
'';
nativeBuildInputs = [
cmake
];