Skip to content

Instantly share code, notes, and snippets.

@peterhoeg
Created August 26, 2019 13:07
Show Gist options
  • Save peterhoeg/af34a63cd5c4a259a783e8764f637770 to your computer and use it in GitHub Desktop.
Save peterhoeg/af34a63cd5c4a259a783e8764f637770 to your computer and use it in GitHub Desktop.
xbows-driver/default.nix
{ stdenv, fetchFromGitHub, autoreconfHook, cmake, pkgconfig, writeText
, boost, libusb, libyamlcpp, netpbm, systemd }:
let
hidapi' = stdenv.mkDerivation rec {
pname = "hidadpi-sc";
version = "unstable-20180609";
src = fetchFromGitHub {
owner = "SuperCollider";
repo = "hidapi";
rev = "80a10cee3d203c83696a4f7bfe0289f17a58deff";
sha256 = "1ywfviwbnc30a0hv5i3pzqdpgwjkwb5rk1vl4rpzcs8lc00krdvr";
};
postPatch = ''
substituteInPlace configure.ac \
--replace 'Werror' 'Werror subdir-objects'
'';
enableParallelBuilding = true;
nativeBuildInputs = [ autoreconfHook pkgconfig ];
buildInputs = [ libusb systemd ];
cmakeFlags = [ "-DHIDAPI=libusb" ];
meta = {};
};
libcrc' = stdenv.mkDerivation rec {
pname = "libcrc";
version = "unstable";
src = fetchFromGitHub {
owner = "lammertb";
repo = pname;
rev = "f4a49c66b32800bdb56fa876c85f0a332b598353";
sha256 = "0k3j3ry3qis8460lvm0z7hclx6fn1bzv45vwx5a2cy796b3ap46w";
};
enableParallelBuilding = true;
postPatch = ''
substituteInPlace Makefile \
--replace -Werror -Wno-format-truncation \
--replace /bin/rm rm
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r lib include $out
runHook postInstall
'';
meta = {};
};
cmakeFile = writeText "CMakeLists.txt" ''
cmake_minimum_required(VERSION 3.5)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
find_library(HIDAPI_LIBRARY hidapi-libusb)
find_library(CRC_LIBRARY crc)
find_library(YAML_LIBRARY yaml-cpp)
add_subdirectory(src)
'';
in stdenv.mkDerivation rec {
pname = "xbows-driver";
version = "unstable-20190719";
src = fetchFromGitHub {
owner = "jlquinn";
repo = pname;
rev = "42612a08c709683a109a03f3d1edc9ef3ccc32d8";
sha256 = "1hdwpj4hn0y6h1vy7hi6s5sybba7vwrwpvrb2is4prpz2z3z4fpl";
};
postPatch = ''
ln -sf ${cmakeFile} CMakeLists.txt
for f in kbdtest.cc kbdtest2.cc xbows.hh ; do
substituteInPlace src/$f --replace '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment