diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-11-21 16:12:21 +0100 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-11-21 16:12:48 +0100 |
commit | 048a4cd441a59cbf89defb18bb45c9f0b4429b35 (patch) | |
tree | f8f5850ff05521ab82d65745894714a8796cbfb6 /pkgs/applications/radio/uhd/default.nix | |
parent | 030c5028b07afcedce7c5956015c629486cc79d9 (diff) | |
parent | 4c2d05dd6435d449a3651a6dd314d9411b5f8146 (diff) | |
download | nixpkgs-rootfs.tar nixpkgs-rootfs.tar.gz nixpkgs-rootfs.tar.bz2 nixpkgs-rootfs.tar.lz nixpkgs-rootfs.tar.xz nixpkgs-rootfs.tar.zst nixpkgs-rootfs.zip |
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Diffstat (limited to 'pkgs/applications/radio/uhd/default.nix')
-rw-r--r-- | pkgs/applications/radio/uhd/default.nix | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/pkgs/applications/radio/uhd/default.nix b/pkgs/applications/radio/uhd/default.nix index 23c0a728586..c3f7b58fa1b 100644 --- a/pkgs/applications/radio/uhd/default.nix +++ b/pkgs/applications/radio/uhd/default.nix @@ -8,13 +8,19 @@ , boost , ncurses , enableCApi ? true -# requires numpy +# Although we handle the Python API's dependencies in pythonEnvArg, this +# feature is currently disabled as upstream attempts to run `python setup.py +# install` by itself, and it fails because the Python's environment's prefix is +# not a writable directly. Adding support for this feature would require using +# python's pypa/build nad pypa/install hooks directly, and currently it is hard +# to do that because it all happens after a long buildPhase of the C API. , enablePythonApi ? false , python3 , buildPackages , enableExamples ? false -, enableUtils ? false +, enableUtils ? true , libusb1 +# Disable dpdk for now due to compilation issues. , enableDpdk ? false , dpdk # Devices @@ -43,9 +49,11 @@ in stdenv.mkDerivation (finalAttrs: { pname = "uhd"; - # UHD seems to use three different version number styles: x.y.z, xxx_yyy_zzz - # and xxx.yyy.zzz. Hrmpf... style keeps changing - version = "4.4.0.0"; + # NOTE: Use the following command to update the package, and the uhdImageSrc attribute: + # + # nix-shell maintainers/scripts/update.nix --argstr package uhd --argstr commit true + # + version = "4.6.0.0"; outputs = [ "out" "dev" ]; @@ -53,14 +61,24 @@ stdenv.mkDerivation (finalAttrs: { owner = "EttusResearch"; repo = "uhd"; rev = "v${finalAttrs.version}"; - sha256 = "sha256-khVOHlvacZc4EMg4m55rxEqPvLY1xURpAfOW905/3jg="; + # The updateScript relies on the `src` using `hash`, and not `sha256. To + # update the correct hash for the `src` vs the `uhdImagesSrc` + hash = "sha256-9ZGt0ZrGbprCmpAuOue6pg2gliu4MvlRFHGxyMJeKAc="; }; # Firmware images are downloaded (pre-built) from the respective release on Github uhdImagesSrc = fetchurl { url = "https://github.com/EttusResearch/uhd/releases/download/v${finalAttrs.version}/uhd-images_${finalAttrs.version}.tar.xz"; - sha256 = "V8ldW8bvYWbrDAvpWpHcMeLf9YvF8PIruDAyNK/bru4="; + # Please don't convert this to a hash, in base64, see comment near src's + # hash. + sha256 = "17g503mhndaabrdl7qai3rdbafr8xx8awsyr7h2bdzwzprzmh4m3"; + }; + passthru = { + updateScript = [ + ./update.sh + # Pass it this file name as argument + (builtins.unsafeGetAttrPos "pname" finalAttrs.finalPackage).file + ]; }; - # TODO: Add passthru.updateScript that will update both of the above hashes... cmakeFlags = [ "-DENABLE_LIBUHD=ON" @@ -123,7 +141,7 @@ stdenv.mkDerivation (finalAttrs: { ]; postPhases = [ "installFirmware" "removeInstalledTests" ] - ++ optionals (enableUtils && stdenv.targetPlatform.isLinux) [ "moveUdevRules" ] + ++ optionals (enableUtils && stdenv.hostPlatform.isLinux) [ "moveUdevRules" ] ; # UHD expects images in `$CMAKE_INSTALL_PREFIX/share/uhd/images` @@ -144,6 +162,10 @@ stdenv.mkDerivation (finalAttrs: { mv $out/lib/uhd/utils/uhd-usrp.rules $out/lib/udev/rules.d/ ''; + disallowedReferences = optionals (!enablePythonApi && !enableUtils) [ + python3 + ]; + meta = with lib; { description = "USRP Hardware Driver (for Software Defined Radio)"; longDescription = '' |