From 1f0253997cd54b2a399584878204316c87e211ea Mon Sep 17 00:00:00 2001 From: Thibaut Marty Date: Thu, 1 Aug 2019 18:56:06 +0200 Subject: [PATCH] urh: add support for Pluto, soundcards, and optionally USRP --- pkgs/applications/radio/urh/default.nix | 13 ++++++++----- pkgs/development/libraries/libiio/default.nix | 13 ++++++++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/radio/urh/default.nix b/pkgs/applications/radio/urh/default.nix index 48c20ecca475..a1b92e7e4e18 100644 --- a/pkgs/applications/radio/urh/default.nix +++ b/pkgs/applications/radio/urh/default.nix @@ -1,5 +1,6 @@ -{ stdenv, fetchFromGitHub, python3Packages -, hackrf, rtl-sdr, airspy, limesuite }: +{ stdenv, lib, fetchFromGitHub, python3Packages +, hackrf, rtl-sdr, airspy, limesuite, libiio +, USRPSupport ? false, uhd }: python3Packages.buildPythonApplication rec { pname = "urh"; @@ -12,14 +13,16 @@ python3Packages.buildPythonApplication rec { sha256 = "1jrrj9c4ddm37m8j0g693xjimpnlvx7lan5kxish5p14xpwdak35"; }; - buildInputs = [ hackrf rtl-sdr airspy limesuite ]; + buildInputs = [ hackrf rtl-sdr airspy limesuite libiio ] + ++ lib.optional USRPSupport uhd; + propagatedBuildInputs = with python3Packages; [ - pyqt5 numpy psutil cython pyzmq + pyqt5 numpy psutil cython pyzmq pyaudio ]; doCheck = false; - meta = with stdenv.lib; { + meta = with lib; { homepage = "https://github.com/jopohl/urh"; description = "Universal Radio Hacker: investigate wireless protocols like a boss"; license = licenses.gpl3; diff --git a/pkgs/development/libraries/libiio/default.nix b/pkgs/development/libraries/libiio/default.nix index ee8029966dc2..df5035461afd 100644 --- a/pkgs/development/libraries/libiio/default.nix +++ b/pkgs/development/libraries/libiio/default.nix @@ -1,6 +1,7 @@ { stdenv, fetchFromGitHub , cmake, flex, bison , libxml2, python +, libusb1, runtimeShell }: stdenv.mkDerivation rec { @@ -17,7 +18,17 @@ stdenv.mkDerivation rec { outputs = [ "out" "lib" "dev" "python" ]; nativeBuildInputs = [ cmake flex bison ]; - buildInputs = [ libxml2 ]; + buildInputs = [ libxml2 libusb1 ]; + + postPatch = '' + substituteInPlace libiio.rules.cmakein \ + --replace /bin/sh ${runtimeShell} + ''; + + # since we can't expand $out in cmakeFlags + preConfigure = '' + cmakeFlags="$cmakeFlags -DUDEV_RULES_INSTALL_DIR=$out/etc/udev/rules.d" + ''; postInstall = '' mkdir -p $python/lib/${python.libPrefix}/site-packages/