Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 21.11 67 lines 2.3 kB view raw
1{ stdenv, lib, fetchFromGitHub, fetchpatch, pkg-config, cmake, git, doxygen, help2man, ncurses, tecla 2, libusb1, udev }: 3let 4 # fetch submodule 5 noos = fetchFromGitHub { 6 owner = "analogdevicesinc"; 7 repo = "no-OS"; 8 rev = "0bba46e6f6f75785a65d425ece37d0a04daf6157"; 9 sha256 = "0is79dhsyp9xmlnfdr1i5s1c22ipjafk9d35jpn5dynpvj86m99c"; 10 }; 11in stdenv.mkDerivation rec { 12 pname = "libbladeRF"; 13 version = "2.2.1"; 14 15 src = fetchFromGitHub { 16 owner = "Nuand"; 17 repo = "bladeRF"; 18 rev = "libbladeRF_v${version}"; 19 sha256 = "0g89al4kwfbx1l3zjddgb9ay4mhr7zk0ndchca3sm1vq2j47nf4l"; 20 }; 21 22 # This patch is required for version 2.2.1. As the patch is already part of 23 # upstream master, it will be incorporated into the next release. The patch 24 # fixes a (well-justified) compiler warning which breaks the build because 25 # we compile with -Werror. 26 patches = [ (fetchpatch { 27 url = "https://github.com/Nuand/bladeRF/commit/163425d48a3b7d8c100d7295220d3648c050d0dd.patch"; 28 sha256 = "1swsymlyxm3yk2k8l71z1fv0a5k2rmab02f0c7xkrvk683mq6yxw"; 29 }) ]; 30 31 nativeBuildInputs = [ cmake pkg-config git doxygen help2man ]; 32 # ncurses used due to https://github.com/Nuand/bladeRF/blob/ab4fc672c8bab4f8be34e8917d3f241b1d52d0b8/host/utilities/bladeRF-cli/CMakeLists.txt#L208 33 buildInputs = [ tecla libusb1 ] 34 ++ lib.optionals stdenv.isLinux [ udev ] 35 ++ lib.optionals stdenv.isDarwin [ ncurses ]; 36 37 38 postUnpack = '' 39 cp -r ${noos}/* source/thirdparty/analogdevicesinc/no-OS/ 40 ''; 41 42 # Fixup shebang 43 prePatch = "patchShebangs host/utilities/bladeRF-cli/src/cmd/doc/generate.bash"; 44 45 # Let us avoid nettools as a dependency. 46 postPatch = '' 47 sed -i 's/$(hostname)/hostname/' host/utilities/bladeRF-cli/src/cmd/doc/generate.bash 48 ''; 49 50 cmakeFlags = [ 51 "-DBUILD_DOCUMENTATION=ON" 52 ] ++ lib.optionals stdenv.isLinux [ 53 "-DUDEV_RULES_PATH=etc/udev/rules.d" 54 "-DINSTALL_UDEV_RULES=ON" 55 "-DBLADERF_GROUP=bladerf" 56 ]; 57 58 hardeningDisable = [ "fortify" ]; 59 60 meta = with lib; { 61 homepage = "https://nuand.com/libbladeRF-doc"; 62 description = "Supporting library of the BladeRF SDR opensource hardware"; 63 license = licenses.lgpl21; 64 maintainers = with maintainers; [ funfunctor ]; 65 platforms = platforms.unix; 66 }; 67}