You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.3KB

  1. let
  2. pkgs = import <nixpkgs> { };
  3. pyqtgraph-qt5 = pkgs.python3Packages.buildPythonPackage rec {
  4. name = "pyqtgraph_qt5-${version}";
  5. version = "0.10.0";
  6. doCheck = false;
  7. src = pkgs.fetchFromGitHub {
  8. owner = "pyqtgraph";
  9. repo = "pyqtgraph";
  10. rev = "1426e334e1d20542400d77c72c132b04c6d17ddb";
  11. sha256 = "1079haxyr316jf0wpirxdj0ry6j8mr16cqr0dyyrd5cnxwl7zssh";
  12. };
  13. propagatedBuildInputs = with pkgs.python3Packages; [ scipy numpy pyqt5 pyopengl ];
  14. };
  15. bitstream = pkgs.fetchurl {
  16. url = "https://www.nuand.com/fpga/v0.11.0/hostedxA4.rbf";
  17. sha256 = "c172e35c4a92cf1e0ca3b37347a84d8376b275ece16cb9c5142b72b82b16fe8e";
  18. };
  19. bladeRF-flash = pkgs.writeShellScriptBin "bladeRF-flash"
  20. # Using the bladeRF bias-tee is royally annoying. Opening the bladeRF turns it off,
  21. # and the API for turning it back on isn't exposed in SoapySDR. Using the configuration
  22. # file works, but breaks FPGA loading since bladeRF-cli then attempts to turn on the
  23. # bias-tee before loading the FPGA. Using the configuration file to load the FPGA
  24. # works the first time and then crashes until the bladeRF is unplugged and plugged back in.
  25. # To work around these assorted bugs, we flash the bladeRF from an empty directory where
  26. # bladeRF-cli won't find the configuration file, and let it boot the FPGA from its flash,
  27. # which seems less buggy/cumbersome than the other options.
  28. ''
  29. TMPDIR=`mktemp -d`
  30. pushd $TMPDIR
  31. ${pkgs.libbladeRF}/bin/bladeRF-cli -L ${bitstream}
  32. popd
  33. rmdir $TMPDIR
  34. '';
  35. sipyco = pkgs.python3Packages.buildPythonPackage rec {
  36. name = "sipyco";
  37. version = "1.1";
  38. src = pkgs.fetchFromGitHub {
  39. owner = "m-labs";
  40. repo = "sipyco";
  41. rev = "v${version}";
  42. sha256 = "09vyrzfhnbp65ybd7w2g96gvvnhzafpn72syls2kbg2paqjjf9gs";
  43. };
  44. propagatedBuildInputs = [ pkgs.python3Packages.numpy ];
  45. };
  46. in
  47. pkgs.mkShell {
  48. nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
  49. buildInputs = [
  50. (pkgs.python3.withPackages(ps: [ps.soapysdr-with-plugins ps.scipy ps.pyserial ps.quamash ps.pyqt5 pyqtgraph-qt5 sipyco]))
  51. pkgs.libbladeRF pkgs.gqrx
  52. bladeRF-flash
  53. ];
  54. dontWrapQtApps = true;
  55. postFixup = ''
  56. wrapQtApp "$out/bin/python"
  57. '';
  58. QT_QPA_PLATFORM = "wayland";
  59. }