{ description = "Additional packages for ARTIQ"; inputs.artiq.url = git+https://github.com/m-labs/artiq.git; outputs = { self, artiq }: let pkgs = import artiq.inputs.nixpkgs { system = "x86_64-linux"; }; condaDeps = with pkgs; [ zlib xorg.libSM xorg.libICE xorg.libX11 xorg.libXau xorg.libXi xorg.libXrender libselinux libGL ]; # Use the full Anaconda distribution, which already contains conda-build and its many dependencies. condaInstaller = pkgs.fetchurl { url = "https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh"; sha256 = "sha256-/t+eNAA5VX97XoqKhq/6nSmfXpggFEvXuSrp9+4IrGA="; }; condaInstallerEnv = pkgs.buildFHSUserEnv { name = "conda-installer-env"; targetPkgs = pkgs: condaDeps; }; condaInstalled = pkgs.stdenvNoCC.mkDerivation { name = "conda-installed"; src = condaInstaller; buildInputs = [ condaInstallerEnv ]; phases = [ "buildPhase" "installPhase" ]; buildPhase = '' cp $src conda-installer.sh chmod +x conda-installer.sh # keep the same file length to avoid breaking embedded payload offsets sed -i 0,/unset\ LD_LIBRARY_PATH/s//\#nset\ LD_LIBRARY_PATH/ conda-installer.sh ''; installPhase = '' conda-installer-env -c "./conda-installer.sh -p $out -b" substituteInPlace $out/lib/python3.9/site-packages/conda/gateways/disk/__init__.py \ --replace "os.chmod(path, 0o2775)" "pass" ''; }; condaBuilderEnv = pkgs.buildFHSUserEnv { name = "conda-builder-env"; targetPkgs = pkgs: condaDeps ++ [ condaInstalled ]; }; makeCondaRecipe = (constituent: '' # conda build breaks if write permissions aren't set on source files. cp --no-preserve=mode,ownership -R ${constituent.src} workaround-conda cd workaround-conda tar cf ../${constituent.name}.tar . cd .. rm -rf workaround-conda mkdir -p conda/${constituent.name} cat << EOF > conda/${constituent.name}/meta.yaml package: name: ${constituent.name} version: ${constituent.version} source: url: ../../${constituent.name}.tar {% set data = load_setup_py_data() %} build: noarch: python entry_points: # NOTE: conda-build cannot distinguish between console and gui scripts {% for entry_point_type, entry_points in data.get("entry_points", dict()).items() -%} {% for entry_point in entry_points -%} - {{ entry_point }} {% endfor %} {% endfor %} ignore_prefix_files: True requirements: run: ${pkgs.lib.concatStringsSep "\n" (map (s: " - ${s}") constituent.dependencies)} EOF cat << EOF > conda/${constituent.name}/build.sh #!/bin/bash set -e ${constituent.preSetup or ""} python setup.py install \ --prefix=\$PREFIX \ --single-version-externally-managed \ --record=record.txt \ --no-compile EOF chmod 755 conda/${constituent.name}/build.sh '' ); makeCondaChannel = constituents: pkgs.stdenvNoCC.mkDerivation { name = "conda-channel"; buildInputs = [ condaBuilderEnv ]; phases = [ "buildPhase" "installPhase" ]; buildPhase = pkgs.lib.concatStringsSep "\n" (map makeCondaRecipe constituents); installPhase = '' HOME=`pwd` mkdir $out conda-builder-env -c " ${pkgs.lib.concatStringsSep "\n" (map (constituent: "conda build --no-anaconda-upload --no-test --output-folder $out conda/${constituent.name}") constituents)} " mkdir $out/nix-support for package in $out/*/*.tar.bz2; do echo file conda $package >> $out/nix-support/hydra-build-products done ''; }; in rec { inherit makeCondaChannel; packages.x86_64-linux = rec { korad_ka3005p = pkgs.python3Packages.buildPythonPackage { pname = "korad_ka3005p"; version = "1.1"; src = pkgs.fetchFromGitHub { owner = "m-labs"; repo = "korad_ka3005p"; rev = "a1898409cb188b388ed1cf84e76ca69e9c8a74eb"; sha256 = "0h20qss70nssqiagc2fx75mravq1pji7rizhag3nq8xrcz2w20nc"; }; propagatedBuildInputs = [ artiq.inputs.sipyco.packages.x86_64-linux.sipyco artiq.packages.x86_64-linux.asyncserial ]; }; novatech409b = pkgs.python3Packages.buildPythonPackage { pname = "novatech409b"; version = "1.1"; src = pkgs.fetchFromGitHub { owner = "m-labs"; repo = "novatech409b"; rev = "3bd559753972f07d881df66b7c6819afc5436053"; sha256 = "1g9qv6fn5h7d393mb1v7w8sg6fimqg34blqdj22qnayb4agw1wyg"; }; propagatedBuildInputs = [ artiq.inputs.sipyco.packages.x86_64-linux.sipyco artiq.packages.x86_64-linux.asyncserial ]; }; lda = pkgs.python3Packages.buildPythonPackage { name = "lda"; version = "1.1"; src = pkgs.fetchFromGitHub { owner = "m-labs"; repo = "lda"; rev = "e6bf828b6dfd7fbf59b61b691712736c98c95970"; sha256 = "1w4ykzsl3386bz4ggpd6i60b6a3k7rnc6qjw59xm3hk0vs3w2vyn"; }; propagatedBuildInputs = [ artiq.inputs.sipyco.packages.x86_64-linux.sipyco ]; postPatch = '' substituteInPlace lda/hidapi.py \ --replace "hidapi_lib_path = None"\ "hidapi_lib_path = '${pkgs.hidapi}/lib/libhidapi-libusb.so.0'" ''; }; thorlabs_tcube = pkgs.python3Packages.buildPythonPackage { pname = "thorlabs_tcube"; version = "1.1"; src = pkgs.fetchFromGitHub { owner = "m-labs"; repo = "thorlabs_tcube"; rev = "0cb0c15fc7e660a150e193245f5338d48f8b97db"; sha256 = "1n4zmjcj2kpd97217y602pq6x8s80w39fgyi6qjmal92aicqdg07"; }; propagatedBuildInputs = [ artiq.inputs.sipyco.packages.x86_64-linux.sipyco artiq.packages.x86_64-linux.asyncserial ]; }; newfocus8742 = pkgs.python3Packages.buildPythonPackage { pname = "newfocus8742"; version = "0.2"; src = pkgs.fetchFromGitHub { owner = "quartiq"; repo = "newfocus8742"; rev = "9f6092b724b33b934aa4d3a1d6a20c295cd1d02d"; sha256 = "0qf05ghylnqf3l5vjx5dc748wi84xn6p6lb6f9r8p6f1z7z67fb8"; }; propagatedBuildInputs = [ artiq.inputs.sipyco.packages.x86_64-linux.sipyco pkgs.python3Packages.pyusb ]; # no unit tests so do a simple smoke test checkPhase = "python -m newfocus8742.aqctl_newfocus8742 -h"; }; hut2 = pkgs.python3Packages.buildPythonPackage { pname = "hut2"; version = "0.2"; src = pkgs.fetchFromGitHub { owner = "quartiq"; repo = "hut2"; rev = "68369d5d63d233827840a9a752d90454a4e03baa"; sha256 = "0r832c0icz8v3w27ci13024bqfslj1gx6dwhjv11ksw229xdcghd"; }; propagatedBuildInputs = [ artiq.inputs.sipyco.packages.x86_64-linux.sipyco ]; # no unit tests without hardware so do a simple smoke test checkPhase = "python -m hut2.aqctl_hut2 -h"; }; wand = pkgs.python3Packages.buildPythonPackage { pname = "wand"; version = "0.4.dev"; src = pkgs.fetchFromGitHub { owner = "OxfordIonTrapGroup"; repo = "wand"; rev = "c080ddab6b2d94bb673ed32a0cea2bf68e66c702"; sha256 = "sha256-T27/mZepPrnheoVEKsP5cRDFc1JffTnuPvXq2r2GP4E="; }; nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ]; dontWrapQtApps = true; postFixup = '' wrapQtApp "$out/bin/wand_gui" ''; propagatedBuildInputs = [ artiq.packages.x86_64-linux.artiq artiq.packages.x86_64-linux.qasync ] ++ [ artiq.inputs.sipyco.packages.x86_64-linux.sipyco ] ++ (with pkgs.python3Packages; [ numpy scipy influxdb pyqtgraph setuptools ]); }; flake8-artiq = pkgs.python3Packages.buildPythonPackage { pname = "flake8-artiq"; version = "0.1.0"; src = pkgs.fetchgit { url = "https://gitlab.com/duke-artiq/flake8-artiq.git"; rev = "1216092974140a561850905734fc22fdacdc2cde"; sha256 = "0rkab2qdwyzms6nxc44jzb5grvkkbpjwwmfv2zj96cm6cm8d9pdr"; }; propagatedBuildInputs = [ pkgs.python3Packages.flake8 ]; checkInputs = [ pkgs.python3Packages.pytestCheckHook ]; }; dax = pkgs.python3Packages.buildPythonPackage rec { pname = "dax"; version = "6.7"; src = pkgs.fetchgit { url = "https://gitlab.com/duke-artiq/dax.git"; rev = "v${version}"; sha256 = "0rgvqqiypqvxjzrsixn3h7dn93isqw5vc2wrmpkxhzvw9lh5ihm7"; }; VERSIONEER_OVERRIDE = version; inherit (pkgs.python3Packages.pygit2) SSL_CERT_FILE; doCheck = false; # tests only pass for the latest stable ARTIQ version propagatedBuildInputs = [ artiq.packages.x86_64-linux.artiq artiq.inputs.sipyco.packages.x86_64-linux.sipyco ] ++ (with pkgs.python3Packages; [ numpy scipy pyvcd natsort pygit2 matplotlib graphviz h5py networkx sortedcontainers ]); checkInputs = [ pkgs.python3Packages.pytestCheckHook ]; }; dax-applets = pkgs.python3Packages.buildPythonPackage rec { pname = "dax-applets"; version = "0.0.0"; src = pkgs.fetchgit { url = "https://gitlab.com/duke-artiq/dax-applets.git"; rev = "0f0196b6941b0c44a33c85d8c02047ca65466463"; sha256 = "0mx6yjvprhdnkdigwns8mg6v5daqxpgbv7mf63fa76i1iv2wvak4"; }; propagatedBuildInputs = [ artiq.packages.x86_64-linux.artiq ] ++ (with pkgs.python3Packages; [ numpy pyqt5 pyqtgraph ]); doCheck = false; }; conda-channel = makeCondaChannel [ { name = "sipyco"; version = artiq.inputs.sipyco.packages.x86_64-linux.sipyco.version; src = artiq.inputs.sipyco.packages.x86_64-linux.sipyco.src; dependencies = [ "numpy" "pybase64" ]; } { name = "pythonparser"; version = artiq.packages.x86_64-linux.pythonparser.version; src = artiq.packages.x86_64-linux.pythonparser.src; dependencies = [ "regex" ]; } { name = "artiq-comtools"; version = artiq.inputs.artiq-comtools.packages.x86_64-linux.artiq-comtools.version; src = artiq.inputs.artiq-comtools.packages.x86_64-linux.artiq-comtools.src; dependencies = [ "numpy" "aiohttp" "sipyco" ]; } { name = "artiq"; version = artiq.packages.x86_64-linux.artiq.version; src = artiq.packages.x86_64-linux.artiq.src; preSetup = '' export VERSIONEER_OVERRIDE=${artiq.packages.x86_64-linux.artiq.version} export VERSIONEER_REV=${artiq.sourceInfo.rev} ''; dependencies = [ "pythonparser" "scipy" "numpy" "prettytable" "h5py" "python-dateutil" "pyqt" "qasync" "pyqtgraph" "pygit2" "python-levenshtein" "sipyco" "llvmlite" "llvm-tools" "lld" "tqdm" "artiq-comtools" ]; } { name = "korad_ka3005p"; version = korad_ka3005p.version; src = korad_ka3005p.src; dependencies = [ "sipyco" "asyncserial" ]; } { name = "novatech409b"; version = novatech409b.version; src = novatech409b.src; dependencies = [ "sipyco" "asyncserial" ]; } { name = "lda"; version = lda.version; src = lda.src; dependencies = [ "sipyco" ]; } { name = "thorlabs_tcube"; version = thorlabs_tcube.version; src = thorlabs_tcube.src; dependencies = [ "sipyco" "asyncserial" ]; } { name = "newfocus8742"; version = newfocus8742.version; src = newfocus8742.src; dependencies = [ "sipyco" ]; } { name = "hut2"; version = hut2.version; src = hut2.src; dependencies = [ "sipyco" ]; } { name = "wand"; version = wand.version; src = wand.src; dependencies = [ "artiq" "qasync" "numpy" "scipy" "influxdb" ]; } { name = "flake8-artiq"; version = flake8-artiq.version; src = flake8-artiq.src; dependencies = [ "flake8" ]; } { name = "dax"; version = dax.version; src = dax.src; dependencies = [ "python>=3.7" "artiq" "sipyco" "numpy" "scipy" "pyvcd" "natsort" "pygit2" "matplotlib" "python-graphviz" "h5py" "networkx" "sortedcontainers" ]; } { name = "dax-applets"; version = dax-applets.version; src = dax-applets.src; dependencies = [ "python>=3.5" "artiq" "numpy" "pyqt" "pyqtgraph" ]; } ]; }; hydraJobs = packages.x86_64-linux; }; }