From 7ade154330a75131ad3c58c41472d555a4b5b157 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 19 Feb 2019 21:18:38 +0800 Subject: [PATCH] cleanup --- artiq/default.nix | 24 ++--- artiq/pkgs/artiq.nix | 96 ++++--------------- .../{python3Packages.nix => python-deps.nix} | 75 ++++++++++++--- main.nix | 5 +- 4 files changed, 95 insertions(+), 105 deletions(-) rename artiq/pkgs/{python3Packages.nix => python-deps.nix} (72%) diff --git a/artiq/default.nix b/artiq/default.nix index 7d8ffaa..f985d9b 100644 --- a/artiq/default.nix +++ b/artiq/default.nix @@ -1,6 +1,8 @@ { pkgs ? import {}}: with pkgs; let + pythonDeps = callPackage ./pkgs/python-deps.nix {}; + # this code was copied from nipxkgs rev. ffafe9 (nixcloud team) and slightly modified rust = callPackage ./pkgs/rust (stdenv.lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) { @@ -27,14 +29,14 @@ let boardBinaries = boardBinaries; }; }) {} boards; -in rec { - inherit (rust) rustc; - inherit (callPackage ./pkgs/python3Packages.nix {}) migen microscope misoc jesd204b; - binutils-or1k = callPackage ./pkgs/binutils-or1k.nix {}; - llvm-or1k = callPackage ./pkgs/llvm-or1k.nix { inherit llvm-src; }; - llvmlite-artiq = callPackage ./pkgs/llvmlite-artiq.nix { inherit llvm-or1k; }; - artiq = callPackage ./pkgs/artiq.nix { inherit binutils-or1k; inherit llvm-or1k; inherit llvmlite-artiq; }; - openocd = callPackage ./pkgs/openocd.nix {}; - - conda-artiq = import ./conda-artiq.nix { inherit pkgs; }; -} // boardPackages +in + rec { + inherit (rust) rustc; + inherit (pythonDeps) asyncserial levenshtein pythonparser quamash pyqtgraph-qt5 misoc migen microscope jesd204b sphinx-argparse wavedrom sphinxcontrib-wavedrom; + binutils-or1k = callPackage ./pkgs/binutils-or1k.nix {}; + llvm-or1k = callPackage ./pkgs/llvm-or1k.nix { inherit llvm-src; }; + llvmlite-artiq = callPackage ./pkgs/llvmlite-artiq.nix { inherit llvm-or1k; }; + artiq = callPackage ./pkgs/artiq.nix { inherit binutils-or1k; inherit llvm-or1k; inherit llvmlite-artiq; }; + openocd = callPackage ./pkgs/openocd.nix {}; + conda-artiq = import ./conda-artiq.nix { inherit pkgs; }; + } // boardPackages diff --git a/artiq/pkgs/artiq.nix b/artiq/pkgs/artiq.nix index af0b1d7..792734a 100644 --- a/artiq/pkgs/artiq.nix +++ b/artiq/pkgs/artiq.nix @@ -1,80 +1,22 @@ -{ stdenv, git, fetchFromGitHub, fetchgit, python3Packages, qt5Full, binutils-or1k, llvm-or1k, llvmlite-artiq, python3 }: +{ stdenv, callPackage, fetchgit, python3Packages, qt5Full, binutils-or1k, llvm-or1k, llvmlite-artiq }: let - -levenshtein = python3Packages.buildPythonPackage rec { - name = "levenshtein"; - src = fetchFromGitHub { - owner = "ztane"; - repo = "python-Levenshtein"; - rev = "854e61a05bb8b750e990add96df412cd5448b75e"; - sha256 = "1yf21kg1g2ivm5a4dx1jra9k0c33np54d0hk5ymnfyc4f6pg386q"; - }; - doCheck = false; -}; - -pythonparser = python3Packages.buildPythonPackage rec { - name = "pythonparser"; - src = fetchFromGitHub { - owner = "m-labs"; - repo = "pythonparser"; - rev = "5b391fe86f43bb9f4f96c5bc0532e2a112db2936"; - sha256 = "1gw1fk4y2l6bwq0fg2a9dfc1rvq8cv492dyil96amjdhsxvnx35b"; - }; - propagatedBuildInputs = with python3Packages; [ regex ]; -}; - -asyncserial = python3Packages.buildPythonPackage rec { - name = "asyncserial"; - src = fetchFromGitHub { - owner = "m-labs"; - repo = "asyncserial"; - rev = "d95bc1d6c791b0e9785935d2f62f628eb5cdf98d"; - sha256 = "0yzkka9jk3612v8gx748x6ziwykq5lr7zmr9wzkcls0v2yilqx9k"; - }; - propagatedBuildInputs = with python3Packages; [ pyserial ]; - doCheck = false; -}; - -quamash = python3Packages.buildPythonPackage rec { - name = "quamash"; - src = fetchFromGitHub { - owner = "harvimt"; - repo = "quamash"; - rev = "e513b30f137415c5e098602fa383e45debab85e7"; - sha256 = "117rp9r4lz0kfz4dmmpa35hp6nhbh6b4xq0jmgvqm68g9hwdxmqa"; - }; - propagatedBuildInputs = with python3Packages; [ pyqt5 ]; - doCheck = false; -}; - -pyqtgraph-qt5 = python3Packages.buildPythonPackage rec { - name = "pyqtgraph_qt5-${version}"; - version = "0.10.0"; - doCheck = false; - src = fetchFromGitHub { - owner = "pyqtgraph"; - repo = "pyqtgraph"; - rev = "1426e334e1d20542400d77c72c132b04c6d17ddb"; - sha256 = "1079haxyr316jf0wpirxdj0ry6j8mr16cqr0dyyrd5cnxwl7zssh"; - }; - propagatedBuildInputs = with python3Packages; [ scipy numpy pyqt5 pyopengl ]; -}; - + pythonDeps = callPackage ./python-deps.nix {}; in - -python3Packages.buildPythonPackage rec { - name = "artiq-${version}"; - version = import ./artiq-version.nix; - src = import ./artiq-src.nix { inherit fetchgit; }; - preBuild = "export VERSIONEER_OVERRIDE=${version}"; - propagatedBuildInputs = with python3Packages; [ binutils-or1k llvm-or1k llvmlite-artiq levenshtein pyqtgraph-qt5 aiohttp pygit2 pythonparser numpy dateutil quamash scipy prettytable pyserial asyncserial h5py cython regex qt5Full pyqt5 ]; - checkPhase = "python -m unittest discover -v artiq.test"; - meta = with stdenv.lib; { - description = "A leading-edge control system for quantum information experiments"; - homepage = https://m-labs/artiq; - license = licenses.lgpl3; - #maintainers = [ maintainers.sb0 ]; - platforms = [ "x86_64-linux" ]; - }; -} + python3Packages.buildPythonPackage rec { + name = "artiq-${version}"; + version = import ./artiq-version.nix; + src = import ./artiq-src.nix { inherit fetchgit; }; + preBuild = "export VERSIONEER_OVERRIDE=${version}"; + propagatedBuildInputs = [ binutils-or1k llvm-or1k llvmlite-artiq ] + ++ (with pythonDeps; [ levenshtein pyqtgraph-qt5 quamash pythonparser asyncserial ]) + ++ (with python3Packages; [ aiohttp pygit2 numpy dateutil scipy prettytable pyserial h5py cython regex qt5Full pyqt5 ]); + checkPhase = "python -m unittest discover -v artiq.test"; + meta = with stdenv.lib; { + description = "A leading-edge control system for quantum information experiments"; + homepage = https://m-labs/artiq; + license = licenses.lgpl3; + #maintainers = [ maintainers.sb0 ]; + platforms = [ "x86_64-linux" ]; + }; + } diff --git a/artiq/pkgs/python3Packages.nix b/artiq/pkgs/python-deps.nix similarity index 72% rename from artiq/pkgs/python3Packages.nix rename to artiq/pkgs/python-deps.nix index bd88eb9..14f2e90 100644 --- a/artiq/pkgs/python3Packages.nix +++ b/artiq/pkgs/python-deps.nix @@ -1,26 +1,68 @@ { pkgs, stdenv, fetchFromGitHub, python, python3Packages }: -rec { +rec { + # User dependencies asyncserial = python3Packages.buildPythonPackage rec { name = "asyncserial"; - src = fetchFromGitHub { owner = "m-labs"; repo = "asyncserial"; rev = "d95bc1d6c791b0e9785935d2f62f628eb5cdf98d"; sha256 = "0yzkka9jk3612v8gx748x6ziwykq5lr7zmr9wzkcls0v2yilqx9k"; - fetchSubmodules = true; - }; - - propagatedBuildInputs = with python3Packages; [ pyserial ] ++ (with pkgs; [ ]); - - meta = with stdenv.lib; { - description = "asyncio support for pyserial"; - homepage = "https://m-labs.hk"; - license = licenses.bsd2; - platforms = platforms.unix; }; + propagatedBuildInputs = with python3Packages; [ pyserial ]; + doCheck = false; }; + + levenshtein = python3Packages.buildPythonPackage rec { + name = "levenshtein"; + src = fetchFromGitHub { + owner = "ztane"; + repo = "python-Levenshtein"; + rev = "854e61a05bb8b750e990add96df412cd5448b75e"; + sha256 = "1yf21kg1g2ivm5a4dx1jra9k0c33np54d0hk5ymnfyc4f6pg386q"; + }; + doCheck = false; + }; + + pythonparser = python3Packages.buildPythonPackage rec { + name = "pythonparser"; + src = fetchFromGitHub { + owner = "m-labs"; + repo = "pythonparser"; + rev = "5b391fe86f43bb9f4f96c5bc0532e2a112db2936"; + sha256 = "1gw1fk4y2l6bwq0fg2a9dfc1rvq8cv492dyil96amjdhsxvnx35b"; + }; + propagatedBuildInputs = with python3Packages; [ regex ]; + }; + + quamash = python3Packages.buildPythonPackage rec { + name = "quamash"; + src = fetchFromGitHub { + owner = "harvimt"; + repo = "quamash"; + rev = "e513b30f137415c5e098602fa383e45debab85e7"; + sha256 = "117rp9r4lz0kfz4dmmpa35hp6nhbh6b4xq0jmgvqm68g9hwdxmqa"; + }; + propagatedBuildInputs = with python3Packages; [ pyqt5 ]; + doCheck = false; + }; + + pyqtgraph-qt5 = python3Packages.buildPythonPackage rec { + name = "pyqtgraph_qt5-${version}"; + version = "0.10.0"; + doCheck = false; + src = fetchFromGitHub { + owner = "pyqtgraph"; + repo = "pyqtgraph"; + rev = "1426e334e1d20542400d77c72c132b04c6d17ddb"; + sha256 = "1079haxyr316jf0wpirxdj0ry6j8mr16cqr0dyyrd5cnxwl7zssh"; + }; + propagatedBuildInputs = with python3Packages; [ scipy numpy pyqt5 pyopengl ]; + }; + + + # Development/firmware dependencies misoc = python3Packages.buildPythonPackage rec { name = "misoc"; @@ -44,6 +86,7 @@ rec { platforms = platforms.unix; }; }; + migen = python3Packages.buildPythonPackage rec { name = "migen"; @@ -66,6 +109,7 @@ rec { platforms = platforms.unix; }; }; + microscope = python3Packages.buildPythonPackage rec { name = "microscope"; @@ -85,6 +129,7 @@ rec { platforms = platforms.unix; }; }; + jesd204b = python3Packages.buildPythonPackage rec { name = "jesd204b"; @@ -105,6 +150,8 @@ rec { }; }; + + # Documentation building dependencies # sphinx-argparse will be included in nixpkgs 19.03 sphinx-argparse = python3Packages.buildPythonPackage rec { pname = "sphinx-argparse"; @@ -124,7 +171,7 @@ rec { description = "A sphinx extension that automatically documents argparse commands and options"; homepage = https://github.com/ribozz/sphinx-argparse; license = licenses.mit; - maintainers = with maintainers; [ clacke ]; + #maintainers = with maintainers; [ clacke ]; }; }; @@ -159,7 +206,7 @@ rec { }; buildInputs = [ python3Packages.setuptools_scm ]; - propagatedBuildInputs = with python3Packages; [ sphinx wavedrom cairosvg xcffib ]; + propagatedBuildInputs = [ wavedrom ] ++ (with python3Packages; [ sphinx cairosvg xcffib ]); meta = with stdenv.lib; { description = "A Sphinx extension that allows including WaveDrom diagrams"; diff --git a/main.nix b/main.nix index a8af869..4582484 100644 --- a/main.nix +++ b/main.nix @@ -18,7 +18,6 @@ let echo \"5e.`cut -c1-8 <<< $REV`\" > $out/pkgs/artiq-version.nix ''; artiqpkgs = import "${generatedNix}/default.nix" { inherit pkgs; }; - python3pkgs = pkgs.callPackage "${generatedNix}/pkgs/python3Packages.nix" {}; artiqVersion = import "${generatedNix}/pkgs/artiq-version.nix"; jobs = builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) artiqpkgs; in @@ -32,7 +31,7 @@ in docs = pkgs.runCommand "docs" { buildInputs = [ - (pkgs.python3.withPackages(ps: [python3pkgs.sphinx-argparse python3pkgs.sphinxcontrib-wavedrom ps.sphinx_rtd_theme ps.sphinx])) + (pkgs.python3.withPackages(ps: [ artiqpkgs.sphinx-argparse artiqpkgs.sphinxcontrib-wavedrom ps.sphinx_rtd_theme ps.sphinx ])) ]; } '' @@ -43,7 +42,7 @@ in ''; extended-tests = pkgs.runCommand "extended-tests" { propagatedBuildInputs = [ - (pkgs.python3.withPackages(ps: [artiqpkgs.artiq artiqpkgs.artiq-board-kc705-nist_clock])) + (pkgs.python3.withPackages(ps: [ artiqpkgs.artiq artiqpkgs.artiq-board-kc705-nist_clock ])) artiqpkgs.binutils-or1k artiqpkgs.openocd pkgs.iputils