nixpkgs/pkgs/servers/brickd/default.nix

65 lines
1.7 KiB
Nix
Raw Normal View History

2022-03-08 17:56:12 +00:00
{ lib, stdenv, fetchFromGitHub, libusb1, pkg-config, pmutils, udev} :
2014-10-27 17:39:45 +00:00
let
2022-03-08 17:56:12 +00:00
version = "2.1.1";
daemonlib = fetchFromGitHub {
owner = "Tinkerforge";
repo = "daemonlib";
rev = "brickd-${version}";
sha256 = "sha256-0HhuC4r1S4NJa2FSJa7+fNCfcoRTBckikYbGSE+2FbE=";
2014-10-27 17:39:45 +00:00
};
in
2019-08-13 21:52:01 +00:00
stdenv.mkDerivation {
2019-08-13 21:52:01 +00:00
pname = "brickd";
inherit version;
2022-03-08 17:56:12 +00:00
src = fetchFromGitHub {
owner = "Tinkerforge";
repo = "brickd";
rev = "v${version}";
sha256 = "sha256-6w2Ew+dLMmdRf9CF3TdKHa0d5ZgmX5lKIR+5t3QAWFQ=";
2014-10-27 17:39:45 +00:00
};
nativeBuildInputs = [ pkg-config ];
2020-04-24 21:39:32 +00:00
buildInputs = [ libusb1 pmutils udev ];
2014-10-27 17:39:45 +00:00
# shell thing didn't work so i replaced it using nix
prePatch = ''
substituteInPlace src/brickd/Makefile --replace 'PKG_CONFIG := $(shell which pkg-config 2> /dev/null)' "PKG_CONFIG := $pkgconfig/bin/pkg_config";
'';
buildPhase = ''
# build the brickd binary
mkdir src/daemonlib
cp -r ${daemonlib}/* src/daemonlib
substituteInPlace src/daemonlib/utils.{c,h} \
--replace "_GNU_SOURCE" "__GLIBC__"
2014-10-27 17:39:45 +00:00
cd src/brickd
make
# build and execute the unit tests
cd ../tests
make
for i in array_test base58_test node_test putenv_test queue_test sha1_test; do
echo "running unit test $i:"
./$i
done
'';
installPhase = ''
cd ../brickd
mkdir -p $out/bin
cp brickd $out/bin/brickd
'';
meta = {
homepage = "https://www.tinkerforge.com/";
description = "Daemon (or service on Windows) that acts as a bridge between the Bricks/Bricklets and the API bindings for the different programming languages";
2021-01-15 07:07:56 +00:00
maintainers = [ lib.maintainers.qknight ];
2024-05-23 08:44:51 +00:00
license = lib.licenses.gpl2Plus;
2021-01-15 07:07:56 +00:00
platforms = lib.platforms.all;
2023-11-27 01:17:53 +00:00
mainProgram = "brickd";
2014-10-27 17:39:45 +00:00
};
}