at v192 60 lines 1.6 kB view raw
1{ stdenv, fetchgit, libusb, pkgconfig, pmutils, udev} : 2 3let 4 5version = "2.1.1"; 6daemonlib = fetchgit { 7 url = "https://github.com/Tinkerforge/daemonlib.git"; 8 rev = "refs/tags/brickd-${version}"; 9 sha256 = "097kaz7d0rzg0ijvcna3y620k3m5fgxpqsac5gbhah8pd7vlj1a4"; 10 }; 11 12in 13 14stdenv.mkDerivation rec { 15 name = "brickd-${version}"; 16 17 src = fetchgit { 18 url = "git://github.com/Tinkerforge/brickd.git"; 19 rev = "refs/tags/v${version}"; 20 sha256 = "08g587bgx628g5vykh482wxiw0z98fmq4lf5ka6aw0v8l9gim9yf"; 21 }; 22 23 buildInputs = [ libusb pkgconfig pmutils udev ]; 24 25 # shell thing didn't work so i replaced it using nix 26 prePatch = '' 27 substituteInPlace src/brickd/Makefile --replace 'PKG_CONFIG := $(shell which pkg-config 2> /dev/null)' "PKG_CONFIG := $pkgconfig/bin/pkg_config"; 28 ''; 29 30 buildPhase = '' 31 export 32 # build the brickd binary 33 mkdir src/daemonlib 34 cp -r ${daemonlib}/* src/daemonlib 35 cd src/brickd 36 make 37 38 # build and execute the unit tests 39 cd ../tests 40 make 41 for i in array_test base58_test node_test putenv_test queue_test sha1_test; do 42 echo "running unit test $i:" 43 ./$i 44 done 45 ''; 46 47 installPhase = '' 48 cd ../brickd 49 mkdir -p $out/bin 50 cp brickd $out/bin/brickd 51 ''; 52 53 meta = { 54 homepage = http://www.tinkerforge.com/; 55 description = "A daemon (or service on Windows) that acts as a bridge between the Bricks/Bricklets and the API bindings for the different programming languages"; 56 maintainers = [ stdenv.lib.maintainers.qknight ]; 57 license = stdenv.lib.licenses.gpl2; 58 platforms = stdenv.lib.platforms.all; 59 }; 60}