nix-scripts/artiq-fast/pkgs/artiq.nix

53 lines
2.3 KiB
Nix
Raw Permalink Normal View History

2021-09-12 18:17:47 +08:00
{ stdenv, lib, pythonDeps, fetchgit, git, python3Packages, qt5, libartiq-support, lit, outputcheck, fontconfig,
binutils-or1k, binutils-arm, llvm-or1k, llvmlite-artiq,
llvm_11, lld_11, llvmlite-llvm11 }:
2020-08-01 10:40:00 +08:00
python3Packages.buildPythonPackage rec {
pname = "artiq";
2020-08-01 10:40:00 +08:00
version = import ./artiq-version.nix { inherit stdenv fetchgit git; };
src = import ./artiq-src.nix { inherit fetchgit; };
preBuild = "export VERSIONEER_OVERRIDE=${version}";
nativeBuildInputs = [ qt5.wrapQtAppsHook ];
2021-09-12 18:17:47 +08:00
propagatedBuildInputs = [ ]
++ (lib.lists.optionals (!lib.strings.versionAtLeast version "7.0") [ binutils-or1k llvm-or1k llvmlite-artiq ])
++ (lib.lists.optionals (lib.strings.versionAtLeast version "7.0") [ llvm_11 lld_11 llvmlite-llvm11 ])
++ (lib.lists.optionals (lib.strings.versionAtLeast version "6.0" && !lib.strings.versionAtLeast version "7.0") [ binutils-arm ])
2021-08-12 13:00:19 +08:00
++ (with pythonDeps; [ sipyco pythonparser ])
++ (with python3Packages; [ pygit2 numpy dateutil scipy prettytable pyserial python-Levenshtein h5py pyqt5 pyqtgraph ])
++ [(if (lib.strings.versionAtLeast version "6.0") then pythonDeps.qasync else python3Packages.quamash)];
2020-08-01 10:40:00 +08:00
dontWrapQtApps = true;
postFixup = ''
wrapQtApp "$out/bin/artiq_dashboard"
wrapQtApp "$out/bin/artiq_browser"
wrapQtApp "$out/bin/artiq_session"
'';
# Modifies PATH to pass the wrapped python environment (i.e. python3.withPackages(...) to subprocesses.
# Allows subprocesses using python to find all packages you have installed
makeWrapperArgs = [
''--run 'if [ ! -z "$NIX_PYTHONPREFIX" ]; then export PATH=$NIX_PYTHONPREFIX/bin:$PATH;fi' ''
"--set FONTCONFIG_FILE ${fontconfig.out}/etc/fonts/fonts.conf"
];
2021-09-12 18:17:47 +08:00
checkInputs = [ lit outputcheck ] ++ (if (lib.strings.versionAtLeast version "7.0") then [ lld_11 llvm_11 ] else [ binutils-or1k ]);
2020-08-01 10:40:00 +08:00
checkPhase =
''
python -m unittest discover -v artiq.test
TESTDIR=`mktemp -d`
2021-09-12 18:17:47 +08:00
cp --no-preserve=mode,ownership -R $src/artiq/test/lit $TESTDIR
LIBARTIQ_SUPPORT=${libartiq-support}/libartiq_support.so lit -v $TESTDIR/lit
2020-08-01 10:40:00 +08:00
'';
2021-03-10 05:48:37 +08:00
meta = with lib; {
2020-08-01 10:40:00 +08:00
description = "A leading-edge control system for quantum information experiments";
homepage = https://m-labs/artiq;
license = licenses.lgpl3;
maintainers = [ maintainers.sb0 ];
};
}