about summary refs log tree commit diff
path: root/pkgs/applications/radio
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2020-03-09 18:30:33 +0200
committerBjørn Forsman <bjorn.forsman@gmail.com>2020-04-05 10:35:22 +0200
commit7da8a30a64a8e130958069343b3a5fee3e6f481e (patch)
tree7521a355f7b00abb23b506260fe7787ffb67e8bf /pkgs/applications/radio
parentbcf5a67e2a4aea8a8d58f666b36430b8f74b6de1 (diff)
uhd: move udev rules to the standard location
Diffstat (limited to 'pkgs/applications/radio')
-rw-r--r--pkgs/applications/radio/uhd/default.nix17
1 files changed, 10 insertions, 7 deletions
diff --git a/pkgs/applications/radio/uhd/default.nix b/pkgs/applications/radio/uhd/default.nix
index 291c162875311..91e28977f6f99 100644
--- a/pkgs/applications/radio/uhd/default.nix
+++ b/pkgs/applications/radio/uhd/default.nix
@@ -31,12 +31,6 @@
 , enableE320 ? true
 }:
 
-# You need these udev rules to not have to run as root (copied from
-# ${uhd}/share/uhd/utils/uhd-usrp.rules):
-#
-#   SUBSYSTEMS=="usb", ATTRS{idVendor}=="fffe", ATTRS{idProduct}=="0002", MODE:="0666"
-#   SUBSYSTEMS=="usb", ATTRS{idVendor}=="2500", ATTRS{idProduct}=="0002", MODE:="0666"
-
 let
   onOffBool = b: if b then "ON" else "OFF";
   inherit (stdenv.lib) optionals;
@@ -127,7 +121,9 @@ stdenv.mkDerivation rec {
   # https://files.ettus.com/manual_archive/v3.15.0.0/html/page_build_guide.html#build_instructions_unix_arm
   patches = if stdenv.isAarch32 then ./neon.patch else null;
 
-  postPhases = [ "installFirmware" "removeInstalledTests" ];
+  postPhases = [ "installFirmware" "removeInstalledTests" ]
+    ++ optionals (enableUtils) [ "moveUdevRules" ]
+  ;
 
   # UHD expects images in `$CMAKE_INSTALL_PREFIX/share/uhd/images`
   installFirmware = ''
@@ -140,6 +136,13 @@ stdenv.mkDerivation rec {
     rm -r $out/lib/uhd/tests
   '';
 
+  # Moves the udev rules to the standard location, needed only if utils are
+  # enabled
+  moveUdevRules = ''
+    mkdir -p $out/lib/udev/rules.d
+    mv $out/lib/uhd/utils/uhd-usrp.rules $out/lib/udev/rules.d/
+  '';
+
   meta = with stdenv.lib; {
     description = "USRP Hardware Driver (for Software Defined Radio)";
     longDescription = ''