Skip to content
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2611.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

- [Nezha](https://github.com/nezhahq/nezha), a self-hosted, lightweight server and website monitoring and O&M tool. Available as [services.nezha](#opt-services.nezha.enable).

- [comlsldd](https://codeberg.org/Pandapip1/comlsldd), a daemon that exposes various devices (primarily EEGs) as LSL streams

- [mail-tlsa-check-exporter](https://github.com/ietf-tools/mail-tlsa-check-exporter), validates SMTP / IMAP server certificates against a TLSA record as a Prometheus exporter. Available as [services.prometheus.exporters.mail-tlsa-check](#opt-services.prometheus.exporters.mail-tlsa-check.enable).

- [CastSponsorSkip](https://github.com/gabe565/CastSponsorSkip/), skips YouTube sponsorships (and sometimes ads) on all local Google Cast devices.
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@
./services/hardware/bolt.nix
./services/hardware/brltty.nix
./services/hardware/buffyboard.nix
./services/hardware/comlsldd.nix
./services/hardware/ddccontrol.nix
./services/hardware/deepcool-digital-linux.nix
./services/hardware/dell-bios-fan-control.nix
Expand Down
104 changes: 104 additions & 0 deletions nixos/modules/services/hardware/comlsldd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
config,
lib,
pkgs,
...
}:

let
inherit (lib)
mkDefault
mkEnableOption
mkIf
mkOption
mkPackageOption
types
;

cfg = config.services.comlsldd;

generateEvenOddPortsFromRange =
from: range:
if range <= 0 then [ ] else [ from ] ++ (generateEvenOddPortsFromRange (from + 2) (range - 2));

portsToOpen =
let
portRange = if (cfg ? liblslConfig.ports.PortRange) then cfg.liblslConfig.ports.PortRange else 32;
multicastPort =
if (cfg ? liblslConfig.ports.MulticastPort) then cfg.liblslConfig.ports.MulticastPort else 16571;
basePort = if (cfg ? liblslConfig.ports.BasePort) then cfg.liblslConfig.ports.BasePort else 16572;
in
(generateEvenOddPortsFromRange multicastPort portRange)
++ (generateEvenOddPortsFromRange basePort portRange);
in
{
options.services.comlsldd = {
enable = mkEnableOption "COMmon LSL Driver Daemon service";

package = mkPackageOption pkgs "comlsldd" { };

openFirewall = mkEnableOption "firewall rules to expose LSL";

liblslConfig = mkOption {
type = lib.types.attrs;
default = { };
description = ''
liblsl configuration options

See https://labstreaminglayer.readthedocs.io/info/lslapicfg.html for more information
'';
};
};

config = mkIf cfg.enable {
systemd.services.comlsldd = {
inherit (cfg.package.meta) description;
wantedBy = [ "multi-user.target" ];

environment = {
RUST_LOG = mkDefault "info";
LSLAPICFG = pkgs.writers.writeTOML "lsl_api.cfg" cfg.liblslConfig;
};

serviceConfig = {
ExecStart = lib.getExe cfg.package;
Type = "notify";

# Hardening
AmbientCapabilities = [ "CAP_SYS_NICE" ];
CapabilityBoundingSet = [ "CAP_SYS_NICE" ];
DynamicUser = true;
KeyringMode = "private";
ProtectHome = true;
ProcSubset = "pid";
ProtectControlGroups = true;
ProtectHostname = true;
ProtectProc = "invisible";
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectClock = true;
PrivateDevices = true;
LockPersonality = true;
MemoryDenyWriteExecute = true;
RestrictAddressFamilies = [
# D-Bus
"AF_UNIX"
# LSL
"AF_INET"
"AF_INET6"
];
RestrictNamespaces = true;
SystemCallArchitectures = "native";
SystemCallFilter = [ "@system-service" ];
};
};

networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = portsToOpen;
allowedUDPPorts = portsToOpen;
};
};

meta.maintainers = with lib.maintainers; [ pandapip1 ];
}
50 changes: 50 additions & 0 deletions pkgs/by-name/co/comlsldd/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
lib,
stdenv,
fetchFromCodeberg,
rustPlatform,
cmake,
dbus,
liblsl,
pkg-config,
nix-update-script,
}:

rustPlatform.buildRustPackage (finalAttrs: {
pname = "comlsldd";
version = "0-unstable-2026-06-29";

src = fetchFromCodeberg {
owner = "Pandapip1";
repo = "comlsldd";
rev = "ff049524c883350c42307d00339dabf8dec08951";
hash = "sha256-GvKOylQrlDQZ9bw6WIXJBf4Pkrnd3m/hSvnClJKiw3k=";
};

cargoHash = "sha256-HmcG2pzgfZIdBecvDtTnmFPSOr414u5v1PncTvvNO+s=";

separateDebugInfo = true;
strictDeps = true;
__structuredAttrs = true;

nativeBuildInputs = [
cmake
pkg-config
rustPlatform.bindgenHook
];
buildInputs = [
dbus
liblsl
];

passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };

meta = {
homepage = "https://codeberg.org/Pandapip1/comlsldd";
description = "COMmon LSL Driver Daemon";
mainProgram = "comlsldd";
license = lib.licenses.agpl3Plus;
maintainers = with lib.maintainers; [ pandapip1 ];
platforms = lib.platforms.all;
};
})
51 changes: 51 additions & 0 deletions pkgs/by-name/li/liblsl/0001-pkg-config.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From da435e3db6033e2bff2388e3d35ea48b029e9ebd Mon Sep 17 00:00:00 2001
From: Gavin John <gavinnjohn@gmail.com>
Date: Sat, 27 Jun 2026 16:00:57 -0400
Subject: [PATCH] feat: add pkg-config support

---
cmake/Installation.cmake | 14 ++++++++++++++
lsl.pc.in | 9 +++++++++
2 files changed, 23 insertions(+)
create mode 100644 lsl.pc.in

diff --git a/cmake/Installation.cmake b/cmake/Installation.cmake
index 4114d29a..4ed7d6e6 100644
--- a/cmake/Installation.cmake
+++ b/cmake/Installation.cmake
@@ -83,6 +83,20 @@ install(
DESTINATION ${LSL_CONFIG_INSTALL_DIR}
)

+# Generate pkg-config file
+if(LSL_UNIXFOLDERS AND NOT LSL_FRAMEWORK)
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/lsl.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/lsl.pc
+ @ONLY
+ )
+ install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/lsl.pc
+ COMPONENT liblsl
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
+ )
+endif()
+
if(APPLE AND LSL_FRAMEWORK AND NOT IOS)
# Create symlinks for the framework. The variables we want to use to identify the symlink locations
# are not available at install time. Instead, we create a script during configuration time that will
diff --git a/lsl.pc.in b/lsl.pc.in
new file mode 100644
index 00000000..49f90967
--- /dev/null
+++ b/lsl.pc.in
@@ -0,0 +1,9 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
+
+Name: liblsl
+Description: @PROJECT_DESCRIPTION@
+Version: @PROJECT_VERSION@
+Libs: -L${libdir} -llsl
+Cflags: -I${includedir}
Loading
Loading