about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/radio/uhd/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/radio/uhd/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/radio/uhd/default.nix38
1 files changed, 30 insertions, 8 deletions
diff --git a/nixpkgs/pkgs/applications/radio/uhd/default.nix b/nixpkgs/pkgs/applications/radio/uhd/default.nix
index 23c0a7285868..6a196cdea350 100644
--- a/nixpkgs/pkgs/applications/radio/uhd/default.nix
+++ b/nixpkgs/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.5.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-0EqMBaQiNr8PE542YNkPvX3o1HhnhrO0Kz1euphY6Ps=";
   };
   # 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 = "13cn41wv7vldk4vx7vy3jbb3wb3a5vpfg3ay893klpi6vzxc1dly";
+  };
+  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"
@@ -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 = ''