noptica2-sdr/shell.nix

60 rader
2.3 KiB
Nix
Permalänk Normal vy Historik

2020-01-05 18:38:43 +08:00
let
pkgs = import <nixpkgs> { };
pyqtgraph-qt5 = pkgs.python3Packages.buildPythonPackage rec {
name = "pyqtgraph_qt5-${version}";
version = "0.10.0";
doCheck = false;
src = pkgs.fetchFromGitHub {
owner = "pyqtgraph";
repo = "pyqtgraph";
rev = "1426e334e1d20542400d77c72c132b04c6d17ddb";
sha256 = "1079haxyr316jf0wpirxdj0ry6j8mr16cqr0dyyrd5cnxwl7zssh";
};
propagatedBuildInputs = with pkgs.python3Packages; [ scipy numpy pyqt5 pyopengl ];
};
2020-01-27 18:26:54 +08:00
bitstream = pkgs.fetchurl {
url = "https://www.nuand.com/fpga/v0.11.0/hostedxA4.rbf";
sha256 = "c172e35c4a92cf1e0ca3b37347a84d8376b275ece16cb9c5142b72b82b16fe8e";
};
bladeRF-flash = pkgs.writeShellScriptBin "bladeRF-flash"
# Using the bladeRF bias-tee is royally annoying. Opening the bladeRF turns it off,
# and the API for turning it back on isn't exposed in SoapySDR. Using the configuration
# file works, but breaks FPGA loading since bladeRF-cli then attempts to turn on the
# bias-tee before loading the FPGA. Using the configuration file to load the FPGA
# works the first time and then crashes until the bladeRF is unplugged and plugged back in.
# To work around these assorted bugs, we flash the bladeRF from an empty directory where
# bladeRF-cli won't find the configuration file, and let it boot the FPGA from its flash,
# which seems less buggy/cumbersome than the other options.
''
TMPDIR=`mktemp -d`
pushd $TMPDIR
${pkgs.libbladeRF}/bin/bladeRF-cli -L ${bitstream}
popd
rmdir $TMPDIR
'';
2020-08-10 01:57:45 +08:00
sipyco = pkgs.python3Packages.buildPythonPackage rec {
name = "sipyco";
version = "1.1";
src = pkgs.fetchFromGitHub {
owner = "m-labs";
repo = "sipyco";
rev = "v${version}";
sha256 = "09vyrzfhnbp65ybd7w2g96gvvnhzafpn72syls2kbg2paqjjf9gs";
};
propagatedBuildInputs = [ pkgs.python3Packages.numpy ];
};
2020-01-05 18:38:43 +08:00
in
pkgs.mkShell {
2020-08-10 01:57:45 +08:00
nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
2020-01-05 18:38:43 +08:00
buildInputs = [
2020-08-10 01:57:45 +08:00
(pkgs.python3.withPackages(ps: [ps.soapysdr-with-plugins ps.scipy ps.pyserial ps.quamash ps.pyqt5 pyqtgraph-qt5 sipyco]))
2020-01-25 15:27:04 +08:00
pkgs.libbladeRF pkgs.gqrx
bladeRF-flash
2020-01-05 18:38:43 +08:00
];
2020-08-10 01:57:45 +08:00
dontWrapQtApps = true;
postFixup = ''
wrapQtApp "$out/bin/python"
'';
2020-08-10 18:56:28 +08:00
QT_QPA_PLATFORM = "wayland";
2020-01-05 18:38:43 +08:00
}