@@ -31,12 +31,6 @@
3131, enableE320 ? true
3232}:
3333
34−# You need these udev rules to not have to run as root (copied from
35−# ${uhd}/share/uhd/utils/uhd-usrp.rules):
36−#
37−# SUBSYSTEMS=="usb", ATTRS{idVendor}=="fffe", ATTRS{idProduct}=="0002", MODE:="0666"
38−# SUBSYSTEMS=="usb", ATTRS{idVendor}=="2500", ATTRS{idProduct}=="0002", MODE:="0666"
39−
4034let
4135 onOffBool = b: if b then "ON" else "OFF";
4236 inherit (stdenv.lib) optionals;
@@ -127,7 +121,9 @@ stdenv.mkDerivation rec {
127121 # https://files.ettus.com/manual_archive/v3.15.0.0/html/page_build_guide.html#build_instructions_unix_arm
128122 patches = if stdenv.isAarch32 then ./neon.patch else null;
129123
130− postPhases = [ "installFirmware" "removeInstalledTests" ];
124+ postPhases = [ "installFirmware" "removeInstalledTests" ]
125+ ++ optionals (enableUtils) [ "moveUdevRules" ]
126+ ;
131127
132128 # UHD expects images in `$CMAKE_INSTALL_PREFIX/share/uhd/images`
133129 installFirmware = ''
@@ -140,6 +136,13 @@ stdenv.mkDerivation rec {
140136 rm -r $out/lib/uhd/tests
141137 '';
142138
139+ # Moves the udev rules to the standard location, needed only if utils are
140+ # enabled
141+ moveUdevRules = ''
142+ mkdir -p $out/lib/udev/rules.d
143+ mv $out/lib/uhd/utils/uhd-usrp.rules $out/lib/udev/rules.d/
144+ '';
145+
143146 meta = with stdenv.lib; {
144147 description = "USRP Hardware Driver (for Software Defined Radio)";
145148 longDescription = ''