nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 58 lines 1.8 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.4.1"; 14 15 src = fetchFromGitHub { 16 owner = "Nuand"; 17 repo = "bladeRF"; 18 rev = "libbladeRF_v${version}"; 19 sha256 = "05axh51lrzxpz2qfswnjwxpfk3mlsv2wc88dd12gfr1karn5jwz9"; 20 }; 21 22 nativeBuildInputs = [ cmake pkg-config git doxygen help2man ]; 23 # ncurses used due to https://github.com/Nuand/bladeRF/blob/ab4fc672c8bab4f8be34e8917d3f241b1d52d0b8/host/utilities/bladeRF-cli/CMakeLists.txt#L208 24 buildInputs = [ tecla libusb1 ] 25 ++ lib.optionals stdenv.isLinux [ udev ] 26 ++ lib.optionals stdenv.isDarwin [ ncurses ]; 27 28 29 postUnpack = '' 30 cp -r ${noos}/* source/thirdparty/analogdevicesinc/no-OS/ 31 ''; 32 33 # Fixup shebang 34 prePatch = "patchShebangs host/utilities/bladeRF-cli/src/cmd/doc/generate.bash"; 35 36 # Let us avoid nettools as a dependency. 37 postPatch = '' 38 sed -i 's/$(hostname)/hostname/' host/utilities/bladeRF-cli/src/cmd/doc/generate.bash 39 ''; 40 41 cmakeFlags = [ 42 "-DBUILD_DOCUMENTATION=ON" 43 ] ++ lib.optionals stdenv.isLinux [ 44 "-DUDEV_RULES_PATH=etc/udev/rules.d" 45 "-DINSTALL_UDEV_RULES=ON" 46 "-DBLADERF_GROUP=bladerf" 47 ]; 48 49 hardeningDisable = [ "fortify" ]; 50 51 meta = with lib; { 52 homepage = "https://nuand.com/libbladeRF-doc"; 53 description = "Supporting library of the BladeRF SDR opensource hardware"; 54 license = licenses.lgpl21; 55 maintainers = with maintainers; [ funfunctor ]; 56 platforms = platforms.unix; 57 }; 58}