Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 86 lines 2.2 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 cmake, 6 pkg-config, 7 makeWrapper, 8 libusb-compat-0_1, 9 ncurses, 10 usePython ? false, 11 python ? null, 12 swig, 13 extraPackages ? [ ], 14 buildPackages, 15 testers, 16}: 17 18stdenv.mkDerivation (finalAttrs: { 19 pname = "soapysdr"; 20 # Don't forget to change passthru.abiVersion 21 version = "0.8.1-unstable-2025-03-30-03"; 22 23 src = fetchFromGitHub { 24 owner = "pothosware"; 25 repo = "SoapySDR"; 26 27 # Instead of applying several patches for Python 3.12 compat, just take the latest, from: 28 # use old get python lib for v2 (#437) 29 rev = "fbf9f3c328868f46029284716df49095ab7b99a6"; 30 hash = "sha256-W4915c6hV/GR5PZRRXZJW3ERsZmQQQ08EA9wYp2tAVk="; 31 }; 32 33 nativeBuildInputs = [ 34 cmake 35 pkg-config 36 makeWrapper 37 ]; 38 buildInputs = [ 39 libusb-compat-0_1 40 ncurses 41 ] 42 ++ lib.optionals usePython [ 43 python 44 swig 45 ]; 46 47 propagatedBuildInputs = lib.optionals usePython [ python.pkgs.numpy ]; 48 49 cmakeFlags = lib.optionals usePython [ "-DUSE_PYTHON_CONFIG=ON" ]; 50 51 postFixup = lib.optionalString (extraPackages != [ ]) ( 52 # Join all plugins via symlinking 53 lib.pipe extraPackages [ 54 (map (pkg: '' 55 ${buildPackages.xorg.lndir}/bin/lndir -silent ${pkg} $out 56 '')) 57 lib.concatStrings 58 ] 59 + '' 60 # Needed for at least the remote plugin server 61 for file in $out/bin/*; do 62 wrapProgram "$file" --prefix SOAPY_SDR_PLUGIN_PATH : ${lib.escapeShellArg (lib.makeSearchPath finalAttrs.passthru.searchPath extraPackages)} 63 done 64 '' 65 ); 66 67 passthru = { 68 tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 69 # SOAPY_SDR_ABI_VERSION defined in include/SoapySDR/Version.h 70 abiVersion = "0.8-3"; 71 searchPath = "lib/SoapySDR/modules${finalAttrs.passthru.abiVersion}"; 72 }; 73 74 meta = with lib; { 75 homepage = "https://github.com/pothosware/SoapySDR"; 76 description = "Vendor and platform neutral SDR support library"; 77 license = licenses.boost; 78 maintainers = with maintainers; [ 79 markuskowa 80 numinit 81 ]; 82 mainProgram = "SoapySDRUtil"; 83 pkgConfigModules = [ "SoapySDR" ]; 84 platforms = platforms.unix; 85 }; 86})