1 { lib, stdenv, fetchFromGitHub, libusb1, pkg-config, pmutils, udev} :
5 daemonlib = fetchFromGitHub {
8 rev = "brickd-${version}";
9 sha256 = "sha256-0HhuC4r1S4NJa2FSJa7+fNCfcoRTBckikYbGSE+2FbE=";
17 src = fetchFromGitHub {
18 owner = "Tinkerforge";
21 sha256 = "sha256-6w2Ew+dLMmdRf9CF3TdKHa0d5ZgmX5lKIR+5t3QAWFQ=";
24 nativeBuildInputs = [ pkg-config ];
25 buildInputs = [ libusb1 pmutils udev ];
27 # shell thing didn't work so i replaced it using nix
29 substituteInPlace src/brickd/Makefile --replace 'PKG_CONFIG := $(shell which pkg-config 2> /dev/null)' "PKG_CONFIG := $pkgconfig/bin/pkg_config";
33 # build the brickd binary
35 cp -r ${daemonlib}/* src/daemonlib
36 substituteInPlace src/daemonlib/utils.{c,h} \
37 --replace "_GNU_SOURCE" "__GLIBC__"
41 # build and execute the unit tests
44 for i in array_test base58_test node_test putenv_test queue_test sha1_test; do
45 echo "running unit test $i:"
53 cp brickd $out/bin/brickd
57 homepage = "https://www.tinkerforge.com/";
58 description = "Daemon (or service on Windows) that acts as a bridge between the Bricks/Bricklets and the API bindings for the different programming languages";
59 maintainers = [ lib.maintainers.qknight ];
60 license = lib.licenses.gpl2Plus;
61 platforms = lib.platforms.all;
62 mainProgram = "brickd";