summaryrefslogtreecommitdiff
path: root/poc/web_swarm/.nix
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-11-13 14:12:49 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-11-13 14:12:49 +0100
commite821d617802ebbfff756844e4d9720342fc78a4e (patch)
tree1dcf33b84698b5074218e44ea491b77a9c23ee66 /poc/web_swarm/.nix
parent0c0087ef9482634273ec1a23d3a915754f94926d (diff)
downloadlibs-lbm-dev.tar.gz
Swarm POCdev
Diffstat (limited to 'poc/web_swarm/.nix')
-rw-r--r--poc/web_swarm/.nix/derivation.nix52
1 files changed, 52 insertions, 0 deletions
diff --git a/poc/web_swarm/.nix/derivation.nix b/poc/web_swarm/.nix/derivation.nix
new file mode 100644
index 0000000..31f1e2b
--- /dev/null
+++ b/poc/web_swarm/.nix/derivation.nix
@@ -0,0 +1,52 @@
+{ lib
+, stdenv
+, scons
+, clang-tools
+, libdatachannel
+, pname
+, version
+, kel
+}:
+
+stdenv.mkDerivation {
+ pname = "${pname}-web-swarm";
+ inherit version;
+ src = ./..;
+
+ nativeBuildInputs = [
+ scons
+ clang-tools
+ ];
+
+ # Ordinary native derivations, so unlike the webgl module these get their
+ # include paths from nix the usual way.
+ #
+ # libdatachannel ships CMake files but no pkg-config, hence the plain
+ # LIBS=['datachannel'] in the SConstruct rather than a pkg-config lookup.
+ # Note there is no forstio here: libdatachannel owns the threads and the
+ # event handling, and forstio has no WebSocket or WebRTC to offer.
+ buildInputs = [
+ libdatachannel
+ kel.lbm.core
+ kel.lbm.swarm
+ ];
+
+ # No checkPhase, and that is a limitation rather than a choice. The nix build
+ # sandbox runs in a network namespace holding only a loopback interface, and
+ # ICE finds no usable candidate there -- libdatachannel reports "Failed to
+ # gather local ICE candidates" and negotiation never completes. Verified: the
+ # same two binaries negotiate and register fine outside the sandbox.
+ #
+ # The end to end check therefore ships as an executable instead, so it is one
+ # command rather than a procedure:
+ #
+ # nix-build -A poc.web_swarm.native
+ # ./result/bin/kel_lbm_web_swarm_check
+ #
+ # The protocol itself is covered natively and in-sandbox by kel.lbm.swarm.
+ doCheck = false;
+
+ preferLocalBuild = true;
+
+ outputs = [ "out" ];
+}