From 032e57b34ced7e7ed5f65be60d1d1c6a47dd6aa6 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Thu, 5 Sep 2024 18:32:11 +0200 Subject: [PATCH 1/5] feat(hostapd): ubus support Signed-off-by: Raito Bezarius --- overlay.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/overlay.nix b/overlay.nix index 2b46089..4fd607c 100644 --- a/overlay.nix +++ b/overlay.nix @@ -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 < Date: Sat, 7 Sep 2024 17:03:50 +0200 Subject: [PATCH 2/5] feat(hostapd): disable openssl to save space Signed-off-by: Raito Bezarius --- overlay.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/overlay.nix b/overlay.nix index 4fd607c..dc6006a 100644 --- a/overlay.nix +++ b/overlay.nix @@ -172,8 +172,7 @@ extraPkgs // { "CONFIG_LIBNL32=y" "CONFIG_PKCS12=y" "CONFIG_RSN_PREAUTH=y" - # Required to read the key material for RADIUS. - "CONFIG_TLS=openssl" + "CONFIG_TLS=internal" ]; h = prev.hostapd.overrideAttrs(o: { extraConfig = ""; @@ -184,7 +183,7 @@ extraPkgs // { ${o.configurePhase} ''; }); - in h.override { sqlite = null; }; + in h.override { openssl = null; sqlite = null; }; From ffc6492365951ae924e8a1baea344cc7f89f9b20 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Sat, 7 Sep 2024 17:13:29 +0200 Subject: [PATCH 3/5] fix(ubus): set the socket path properly Signed-off-by: Raito Bezarius --- modules/ubus/service.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ubus/service.nix b/modules/ubus/service.nix index e1e297e..80548c6 100644 --- a/modules/ubus/service.nix +++ b/modules/ubus/service.nix @@ -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 + ''; } From 5444059b6324ba9ccea5a37926df95fa3d7fa055 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Sat, 7 Sep 2024 17:18:59 +0200 Subject: [PATCH 4/5] feat(hostapd): enable ubus on RADIUS variant Signed-off-by: Raito Bezarius --- overlay.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/overlay.nix b/overlay.nix index dc6006a..6032257 100644 --- a/overlay.nix +++ b/overlay.nix @@ -172,9 +172,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 < Date: Sat, 7 Sep 2024 17:35:09 +0200 Subject: [PATCH 5/5] fix(ubus): rendez vous URL for the unix socket Signed-off-by: Raito Bezarius --- pkgs/ubus/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/ubus/default.nix b/pkgs/ubus/default.nix index c5c78a1..88ea647 100644 --- a/pkgs/ubus/default.nix +++ b/pkgs/ubus/default.nix @@ -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 ];