nix-scripts/artiq-full/extras.nix

293 lines
11 KiB
Nix
Raw Permalink Normal View History

2021-06-07 00:59:24 +08:00
{ pkgs, sipyco, asyncserial, pyqtgraph-qt5, artiq }:
2019-04-19 20:16:59 +08:00
let
2020-06-09 16:11:08 +08:00
condaBuild = import ./fast/conda/build.nix { inherit pkgs; };
condaFakeSource = import ./fast/conda/fake-source.nix { inherit pkgs; };
dualPackage = (
{ name, version, src, pythonOptions ? {}, condaOptions ? {}, withManual ? true}:
{
"${name}" = pkgs.python3Packages.buildPythonPackage ({
inherit version;
name = "${name}-${version}";
inherit src;
} // pythonOptions);
"conda-${name}" = condaBuild {
name = "conda-${name}";
src = condaFakeSource ({
inherit name version src;
} // condaOptions);
};
} // (pkgs.lib.optionalAttrs withManual {
2020-12-12 14:30:57 +08:00
"${name}-manual-html" = pkgs.stdenv.mkDerivation {
2019-04-23 13:52:12 +08:00
name = "${name}-manual-html-${version}";
inherit version src;
buildInputs = (with pkgs.python3Packages; [ sphinx sphinx_rtd_theme sphinx-argparse ]) ++ [ artiq ];
preBuild = ''
2019-07-17 20:22:13 +08:00
export SOURCE_DATE_EPOCH=${import ./fast/pkgs/artiq-timestamp.nix { inherit (pkgs) stdenv fetchgit git; }}
cd doc
'';
2019-04-23 13:52:12 +08:00
makeFlags = [ "html" ];
installPhase =
let
dest = "$out/share/doc/${name}-manual";
in
''
mkdir -p ${dest}
cp -r _build/html ${dest}/
mkdir -p $out/nix-support/
echo doc manual ${dest}/html index.html >> $out/nix-support/hydra-build-products
'';
};
})
);
2019-04-19 23:01:03 +08:00
# https://github.com/m-labs/artiq/issues/23
hidapi = pkgs.hidapi.overrideAttrs (oa: {
src = pkgs.fetchFromGitHub {
owner = "signal11";
repo = "hidapi";
rev = "a6a622ffb680c55da0de787ff93b80280498330f";
sha256 = "17n7c4v3jjrnzqwxpflggxjn6vkzscb32k4kmxqjbfvjqnx7qp7j";
};
});
in
(dualPackage {
name = "korad_ka3005p";
2019-11-07 19:34:36 +08:00
version = "1.1";
src = pkgs.fetchFromGitHub {
owner = "m-labs";
repo = "korad_ka3005p";
2021-01-15 16:53:54 +08:00
rev = "a1898409cb188b388ed1cf84e76ca69e9c8a74eb";
sha256 = "0h20qss70nssqiagc2fx75mravq1pji7rizhag3nq8xrcz2w20nc";
2019-04-19 19:49:07 +08:00
};
2019-11-07 19:34:36 +08:00
pythonOptions = { propagatedBuildInputs = [ sipyco asyncserial ]; };
condaOptions = { dependencies = [ "sipyco" "asyncserial" ]; };
2019-04-19 21:55:57 +08:00
}) // (dualPackage {
name = "novatech409b";
2019-11-07 19:34:36 +08:00
version = "1.1";
2019-04-19 21:55:57 +08:00
src = pkgs.fetchFromGitHub {
owner = "m-labs";
repo = "novatech409b";
2021-01-15 16:53:54 +08:00
rev = "3bd559753972f07d881df66b7c6819afc5436053";
sha256 = "1g9qv6fn5h7d393mb1v7w8sg6fimqg34blqdj22qnayb4agw1wyg";
2019-04-19 21:55:57 +08:00
};
2019-11-07 19:34:36 +08:00
pythonOptions = { propagatedBuildInputs = [ sipyco asyncserial ]; };
condaOptions = { dependencies = [ "sipyco" "asyncserial" ]; };
2019-04-19 23:01:03 +08:00
}) // (dualPackage {
name = "lda";
2019-11-07 19:34:36 +08:00
version = "1.1";
2019-04-19 23:01:03 +08:00
src = pkgs.fetchFromGitHub {
owner = "m-labs";
repo = "lda";
2021-01-15 16:53:54 +08:00
rev = "e6bf828b6dfd7fbf59b61b691712736c98c95970";
sha256 = "1w4ykzsl3386bz4ggpd6i60b6a3k7rnc6qjw59xm3hk0vs3w2vyn";
2019-04-19 23:01:03 +08:00
};
pythonOptions = {
2019-11-07 19:34:36 +08:00
propagatedBuildInputs = [ sipyco ];
2019-04-19 23:01:03 +08:00
postPatch = ''
substituteInPlace lda/hidapi.py \
--replace "hidapi_lib_path = None"\
"hidapi_lib_path = '${hidapi}/lib/libhidapi-libusb.so.0'"
'';
};
2019-11-07 19:34:36 +08:00
condaOptions = { dependencies = [ "sipyco" ]; };
2019-04-20 00:10:17 +08:00
}) // (dualPackage {
name = "thorlabs_tcube";
2019-11-07 19:34:36 +08:00
version = "1.1";
2019-04-20 00:10:17 +08:00
src = pkgs.fetchFromGitHub {
owner = "m-labs";
repo = "thorlabs_tcube";
2021-01-15 16:53:54 +08:00
rev = "0cb0c15fc7e660a150e193245f5338d48f8b97db";
sha256 = "1n4zmjcj2kpd97217y602pq6x8s80w39fgyi6qjmal92aicqdg07";
2019-04-20 00:10:17 +08:00
};
2019-11-07 19:34:36 +08:00
pythonOptions = { propagatedBuildInputs = [ sipyco asyncserial ]; };
condaOptions = { dependencies = [ "sipyco" "asyncserial" ]; };
2019-04-19 22:03:02 +08:00
}) // (dualPackage {
name = "newfocus8742";
2019-11-07 19:34:36 +08:00
version = "0.2";
2019-04-19 22:03:02 +08:00
src = pkgs.fetchFromGitHub {
owner = "quartiq";
repo = "newfocus8742";
2019-11-07 19:34:36 +08:00
rev = "9f6092b724b33b934aa4d3a1d6a20c295cd1d02d";
sha256 = "0qf05ghylnqf3l5vjx5dc748wi84xn6p6lb6f9r8p6f1z7z67fb8";
};
pythonOptions = {
2019-11-07 19:34:36 +08:00
propagatedBuildInputs = [ sipyco pkgs.python3Packages.pyusb ];
# no unit tests so do a simple smoke test
2019-11-07 19:34:36 +08:00
checkPhase = "python -m newfocus8742.aqctl_newfocus8742 -h";
2019-04-19 22:03:02 +08:00
};
2019-11-07 19:34:36 +08:00
condaOptions = { dependencies = [ "sipyco" ]; };
2019-04-22 22:59:19 +08:00
}) // (dualPackage {
name = "hut2";
2019-11-07 19:34:36 +08:00
version = "0.2";
2019-04-22 22:59:19 +08:00
src = pkgs.fetchFromGitHub {
owner = "quartiq";
repo = "hut2";
2019-11-12 22:18:38 +08:00
rev = "68369d5d63d233827840a9a752d90454a4e03baa";
sha256 = "0r832c0icz8v3w27ci13024bqfslj1gx6dwhjv11ksw229xdcghd";
2019-04-22 22:59:19 +08:00
};
pythonOptions = {
2019-11-07 19:34:36 +08:00
propagatedBuildInputs = [ sipyco ];
2019-04-22 22:59:19 +08:00
# no unit tests without hardware so do a simple smoke test
2019-11-07 19:34:36 +08:00
checkPhase = "python -m hut2.aqctl_hut2 -h";
2019-04-22 22:59:19 +08:00
};
2019-11-07 19:34:36 +08:00
condaOptions = { dependencies = [ "sipyco" ]; };
}) // rec {
2019-04-22 23:30:29 +08:00
toptica-lasersdk = pkgs.python3Packages.buildPythonPackage rec {
version = "2.0.0";
name = "toptica-lasersdk-${version}";
format = "wheel";
src = pkgs.fetchurl {
url = "https://files.pythonhosted.org/packages/6b/e2/5c98407215884c2570453a78bc0d6f0bbe619f06593847ccd6a2f1d3fe59/toptica_lasersdk-2.0.0-py3-none-any.whl";
sha256 = "1k5d9ah8qzp75hh63nh9l5dk808v9ybpmzlhrdc3sxmas3ajv8s7";
};
propagatedBuildInputs = [ pkgs.python3Packages.pyserial ];
};
toptica-lasersdk-artiq = pkgs.python3Packages.buildPythonPackage rec {
2019-11-07 19:34:36 +08:00
version = "0.2";
name = "toptica-lasersdk-artiq-${version}";
src = pkgs.fetchFromGitHub {
owner = "quartiq";
repo = "lasersdk-artiq";
2020-01-27 22:59:11 +08:00
rev = "901dec13a1bf9429ce7ab49be34b03d1c49b8a9f";
2020-01-29 10:01:34 +08:00
sha256 = "0lqxvgvpgrpw1kzhg5axnfb40ils2vdk75r43hqmk2lfz4sydwb2";
};
postPatch = ''
substituteInPlace lasersdk_artiq/aqctl_laser.py \
--replace "toptica.lasersdk.async.client" \
"toptica.lasersdk.asyncio.client"
substituteInPlace lasersdk_artiq/test.py \
--replace "toptica.lasersdk.async.client" \
"toptica.lasersdk.asyncio.client"
'';
2019-11-07 19:34:36 +08:00
propagatedBuildInputs = [ sipyco toptica-lasersdk ];
};
conda-toptica-lasersdk-artiq = condaBuild {
name = "conda-toptica-lasersdk-artiq";
src = condaFakeSource {
name = "toptica-lasersdk-artiq";
inherit (toptica-lasersdk-artiq) version src;
dependencies = [ "sipyco" "lasersdk =1.3.1" ];
};
};
2019-04-23 00:01:37 +08:00
} // (dualPackage {
name = "highfinesse-net";
2019-11-07 19:34:36 +08:00
version = "0.2";
2019-04-23 00:01:37 +08:00
src = pkgs.fetchFromGitHub {
owner = "quartiq";
repo = "highfinesse-net";
2019-11-26 23:28:37 +08:00
rev = "a9cc049c9846845d2b2d8662266ec11fe770abee";
sha256 = "01mk4gf6rk3jqpz4y7m35vawjybvyp26bizz5a4ygkb8dq5l51g4";
2019-04-23 00:01:37 +08:00
};
pythonOptions = {
2019-11-07 19:34:36 +08:00
propagatedBuildInputs = [ sipyco ];
2019-04-23 00:01:37 +08:00
# no unit tests without hardware so do a simple smoke test
2019-11-07 19:34:36 +08:00
checkPhase = "python -m highfinesse_net.aqctl_highfinesse_net -h";
2019-04-23 00:01:37 +08:00
};
2019-11-07 19:34:36 +08:00
condaOptions = { dependencies = [ "sipyco" ]; };
2019-11-14 15:22:17 +08:00
}) // rec {
artiq-comtools = pkgs.python3Packages.buildPythonPackage rec {
name = "artiq-comtools-${version}";
2020-04-25 12:47:23 +08:00
version = "1.1";
2019-11-14 15:22:17 +08:00
src = pkgs.fetchFromGitHub {
owner = "m-labs";
repo = "artiq-comtools";
2020-04-25 12:47:23 +08:00
rev = "v${version}";
sha256 = "165j12k9nnrkf2pv0idcv6xhnp1hnsllna4rps2dssnqgjfaw1ss";
2019-11-14 15:22:17 +08:00
};
propagatedBuildInputs = [ sipyco pkgs.python3Packages.numpy pkgs.python3Packages.aiohttp ];
# 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' '' ];
2019-11-14 15:22:17 +08:00
};
conda-artiq-comtools = condaBuild {
name = "conda-artiq-comtools";
src = condaFakeSource {
name = "artiq-comtools";
inherit (artiq-comtools) version src;
dependencies = [ "sipyco" "numpy" "aiohttp >=3" ];
};
};
2020-11-23 23:23:02 +08:00
} // {
wand = pkgs.python3Packages.buildPythonApplication rec {
name = "wand";
version = "0.4.dev";
src = pkgs.fetchFromGitHub {
owner = "OxfordIonTrapGroup";
repo = "wand";
rev = "0bf1cfef4aa37e5761c20ac8702abec125b45e23";
sha256 = "0jfw6w6id7qkx2f6rklrmp13b2hsnvii1qbls60ampx399lcb43g";
};
patches = [ ./wand-fix-config-dir.patch ];
nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
dontWrapQtApps = true;
postFixup = ''
wrapQtApp "$out/bin/wand_gui"
'';
2020-12-16 15:44:12 +08:00
propagatedBuildInputs = with pkgs.python3Packages; [ artiq quamash numpy scipy influxdb setuptools ];
2020-11-23 23:23:02 +08:00
};
2020-12-08 13:45:40 +08:00
} // (dualPackage {
name = "flake8-artiq";
2021-03-09 01:14:12 +08:00
version = "0.1.0";
withManual = false;
2020-12-08 13:45:40 +08:00
src = pkgs.fetchgit {
url = "https://gitlab.com/duke-artiq/flake8-artiq.git";
2021-06-07 00:30:25 +08:00
rev = "779e41c8cf3e05dac4b7c2802640eb0442cf65d9";
sha256 = "1vz6m1w1i1xf72wqzl4ahlv9mcxa6zn8wv05s4yq4cph0hk6inn0";
2020-12-08 13:45:40 +08:00
};
pythonOptions = {
propagatedBuildInputs = [ pkgs.python3Packages.flake8 ];
checkInputs = [ pkgs.python3Packages.pytest pkgs.python3Packages.mypy pkgs.python3Packages.flake8 ];
checkPhase =
''
pytest
mypy
flake8
'';
};
condaOptions = { dependencies = [ "flake8" ]; };
2021-06-08 15:40:40 +08:00
}) // (dualPackage rec {
2021-06-07 00:48:39 +08:00
name = "dax";
version = "6.3";
withManual = false;
src = pkgs.fetchgit {
url = "https://gitlab.com/duke-artiq/dax.git";
rev = "v${version}";
2021-06-09 19:29:59 +08:00
sha256 = "17bgqal8iyajnmp11wd59k4i8gpa3zf3cm7v8mjail5c8bnwyl4c";
2021-06-07 00:48:39 +08:00
};
pythonOptions = {
VERSIONEER_OVERRIDE = version;
inherit (pkgs.python3Packages.pygit2) SSL_CERT_FILE;
propagatedBuildInputs = [ artiq sipyco ]
++ (with pkgs.python3Packages; [ numpy scipy pyvcd natsort pygit2 matplotlib graphviz h5py networkx ]);
2021-06-10 06:24:15 +08:00
doCheck = false;
2021-06-07 00:48:39 +08:00
checkInputs = [ pkgs.python3Packages.pytest pkgs.python3Packages.mypy pkgs.python3Packages.flake8 ];
checkPhase =
''
pytest
mypy
flake8
'';
};
condaOptions = { dependencies = [ "python>=3.7" "artiq" "sipyco" "numpy" "scipy" "pyvcd" "natsort" "pygit2" "matplotlib" "python-graphviz" "h5py" "networkx" ]; };
2021-06-07 00:59:24 +08:00
}) // (dualPackage {
name = "dax-applets";
version = "0.0.0";
withManual = false;
src = pkgs.fetchgit {
url = "https://gitlab.com/duke-artiq/dax-applets.git";
rev = "e25f0c83ef246d2913cbd97379b67ac02896745b";
sha256 = "0d0fkw27bhd0hky512km6iiiagwkdzw4vxgcd4cjq08nmh72jxv1";
};
pythonOptions = {
propagatedBuildInputs = [ artiq pyqtgraph-qt5 ]
2021-06-07 00:59:24 +08:00
++ (with pkgs.python3Packages; [ numpy pyqt5 ]);
checkInputs = [ pkgs.python3Packages.mypy pkgs.python3Packages.flake8 ];
checkPhase =
''
mypy
flake8
'';
};
condaOptions = { dependencies = [ "python>=3.5" "artiq" "numpy" "pyqt" "pyqtgraph" ]; };
2020-12-08 13:45:40 +08:00
})