Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 pkg-config, 6 cmake, 7 git, 8 doxygen, 9 help2man, 10 ncurses, 11 tecla, 12 libusb1, 13 udev, 14}: 15 16stdenv.mkDerivation rec { 17 pname = "libbladeRF"; 18 version = "2.5.0"; 19 20 src = fetchFromGitHub { 21 owner = "Nuand"; 22 repo = "bladeRF"; 23 rev = "libbladeRF_v${version}"; 24 hash = "sha256-H40w5YKp6M3QLrsPhILEnJiWutCYLtbgC4a63sV397Q="; 25 fetchSubmodules = true; 26 }; 27 28 patches = [ 29 # https://github.com/Nuand/bladeRF/issues/994 30 ./gcc-14-calloc-fixes.diff 31 ]; 32 33 nativeBuildInputs = [ 34 cmake 35 pkg-config 36 git 37 doxygen 38 help2man 39 ]; 40 # ncurses used due to https://github.com/Nuand/bladeRF/blob/ab4fc672c8bab4f8be34e8917d3f241b1d52d0b8/host/utilities/bladeRF-cli/CMakeLists.txt#L208 41 buildInputs = [ 42 tecla 43 libusb1 44 ] 45 ++ lib.optionals stdenv.hostPlatform.isLinux [ udev ] 46 ++ lib.optionals stdenv.hostPlatform.isDarwin [ ncurses ]; 47 48 # Fixup shebang 49 prePatch = "patchShebangs host/utilities/bladeRF-cli/src/cmd/doc/generate.bash"; 50 51 # Let us avoid net-tools as a dependency. 52 postPatch = '' 53 sed -i 's/$(hostname)/hostname/' host/utilities/bladeRF-cli/src/cmd/doc/generate.bash 54 ''; 55 56 doInstallCheck = true; 57 58 cmakeFlags = [ 59 "-DBUILD_DOCUMENTATION=ON" 60 ] 61 ++ lib.optionals stdenv.hostPlatform.isLinux [ 62 "-DUDEV_RULES_PATH=etc/udev/rules.d" 63 "-DINSTALL_UDEV_RULES=ON" 64 "-DBLADERF_GROUP=bladerf" 65 ]; 66 67 env = lib.optionalAttrs stdenv.cc.isClang { 68 NIX_CFLAGS_COMPILE = "-Wno-error=unused-but-set-variable"; 69 }; 70 71 hardeningDisable = [ "fortify" ]; 72 73 meta = with lib; { 74 homepage = "https://nuand.com/libbladeRF-doc"; 75 description = "Supporting library of the BladeRF SDR opensource hardware"; 76 license = licenses.lgpl21; 77 maintainers = with maintainers; [ markuskowa ]; 78 platforms = platforms.unix; 79 }; 80}