add our own packages to nix environment

This commit is contained in:
Ada 2022-02-23 19:06:04 -07:00
parent bbb883ed82
commit be6b907eea
4 changed files with 127 additions and 45 deletions

View File

@ -4,7 +4,6 @@ let
artiq6 = pkgs.lib.strings.versionAtLeast mainPackages.artiq.version "6.0"; artiq6 = pkgs.lib.strings.versionAtLeast mainPackages.artiq.version "6.0";
artiq7 = pkgs.lib.strings.versionAtLeast mainPackages.artiq.version "7.0"; artiq7 = pkgs.lib.strings.versionAtLeast mainPackages.artiq.version "7.0";
pythonDeps = import ./pkgs/python-deps.nix { inherit (pkgs) lib fetchgit fetchFromGitHub python3Packages; misoc-new = artiq7; }; pythonDeps = import ./pkgs/python-deps.nix { inherit (pkgs) lib fetchgit fetchFromGitHub python3Packages; misoc-new = artiq7; };
rustPlatform = import ./rust-platform.nix { inherit pkgs; };
boards = [ boards = [
{ target = "kasli"; variant = "tester"; } { target = "kasli"; variant = "tester"; }
@ -12,7 +11,7 @@ let
]; ];
boardPackages = pkgs.lib.lists.foldr (board: start: boardPackages = pkgs.lib.lists.foldr (board: start:
let let
boardBinaries = import ./artiq-board.nix { inherit pkgs rustPlatform; } { boardBinaries = import ./artiq-board.nix { inherit pkgs; } {
target = board.target; target = board.target;
variant = board.variant; variant = board.variant;
}; };
@ -22,22 +21,20 @@ let
}) {} boards; }) {} boards;
mainPackages = rec { mainPackages = rec {
inherit (pythonDeps) sipyco asyncserial pythonparser artiq-netboot misoc migen microscope jesd204b migen-axi lit outputcheck qasync; inherit (pythonDeps) sipyco artiq_tools asyncserial pythonparser artiq-netboot misoc migen microscope jesd204b migen-axi lit outputcheck qasync pyqtgraph;
binutils-or1k = callPackage ./pkgs/binutils.nix { platform = "or1k"; target = "or1k-linux"; }; binutils-or1k = callPackage ./pkgs/binutils.nix { platform = "or1k"; target = "or1k-linux"; };
binutils-arm = callPackage ./pkgs/binutils.nix { platform = "arm"; target = "armv7-unknown-linux-gnueabihf"; }; binutils-arm = callPackage ./pkgs/binutils.nix { platform = "arm"; target = "armv7-unknown-linux-gnueabihf"; };
llvm-or1k = callPackage ./pkgs/llvm-or1k.nix {}; llvm-or1k = callPackage ./pkgs/llvm-or1k.nix {};
rustc-legacy = callPackage ./pkgs/rust-legacy/rustc-with-crates.nix rustc = callPackage ./pkgs/rust/rustc-with-crates.nix
((lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) { ((lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) {
stdenv = overrideCC stdenv gcc6; # with gcc-7: undefined reference to `__divmoddi4' stdenv = overrideCC stdenv gcc6; # with gcc-7: undefined reference to `__divmoddi4'
}) // }) //
{ inherit llvm-or1k; }); { inherit llvm-or1k; });
rustc = if artiq7 then rustPlatform.rust.rustc else rustc-legacy; cargo = callPackage ./pkgs/rust/cargo.nix { inherit rustc; rustPlatform = rustPackages_1_45.rustPlatform; };
cargo-legacy = callPackage ./pkgs/rust-legacy/cargo.nix { inherit rustc; rustPlatform = rustPackages_1_45.rustPlatform; }; cargo-vendor = callPackage ./pkgs/rust/cargo-vendor.nix {};
cargo-vendor-legacy = callPackage ./pkgs/rust-legacy/cargo-vendor.nix {};
llvmlite-artiq = callPackage ./pkgs/llvmlite-artiq.nix { inherit llvm-or1k; }; llvmlite-artiq = callPackage ./pkgs/llvmlite-artiq.nix { inherit llvm-or1k; };
llvmlite-llvm11 = callPackage ./pkgs/llvmlite-llvm11.nix { };
libartiq-support = callPackage ./pkgs/libartiq-support.nix { inherit rustc; }; libartiq-support = callPackage ./pkgs/libartiq-support.nix { inherit rustc; };
artiq = callPackage ./pkgs/artiq.nix { inherit pythonDeps binutils-or1k binutils-arm llvm-or1k llvmlite-artiq llvmlite-llvm11 libartiq-support lit outputcheck; }; artiq = callPackage ./pkgs/artiq.nix { inherit pythonDeps binutils-or1k binutils-arm llvm-or1k llvmlite-artiq libartiq-support lit outputcheck; };
artiq-env = (pkgs.python3.withPackages(ps: [ artiq ])).overrideAttrs (oldAttrs: { name = "${pkgs.python3.name}-artiq-env-${artiq.version}"; }); artiq-env = (pkgs.python3.withPackages(ps: [ artiq ])).overrideAttrs (oldAttrs: { name = "${pkgs.python3.name}-artiq-env-${artiq.version}"; });
openocd = callPackage ./pkgs/openocd.nix { }; openocd = callPackage ./pkgs/openocd.nix { };
}; };
@ -77,6 +74,14 @@ let
inherit (pythonDeps.qasync) version src; inherit (pythonDeps.qasync) version src;
}; };
}; };
conda-pyqtgraph = import ./conda/build.nix { inherit pkgs; } {
pname = "conda-pyqtgraph";
inherit (pythonDeps.pyqtgraph) version;
src = import ./conda/fake-source.nix { inherit pkgs; } {
name = "pyqtgraph";
inherit (pythonDeps.pyqtgraph) version src;
};
};
conda-bscan-spi-bitstreams = import ./conda/bscan-spi-bitstreams.nix { conda-bscan-spi-bitstreams = import ./conda/bscan-spi-bitstreams.nix {
inherit pkgs; inherit pkgs;
bscan_spi_bitstreams = "${mainPackages.openocd}/share/bscan-spi-bitstreams"; bscan_spi_bitstreams = "${mainPackages.openocd}/share/bscan-spi-bitstreams";
@ -93,13 +98,7 @@ let
}; };
}; };
condaLinux = if artiq7 then ({ condaLinux = rec {
# ARTIQ-7 uses upstream conda-forge packages except llvmlite
conda-llvmlite = import ./conda/llvmlite-patched.nix {
inherit pkgs;
inherit (mainPackages.llvmlite-llvm11) src;
};
}) else (rec {
conda-binutils-or1k = import ./conda/binutils.nix { conda-binutils-or1k = import ./conda/binutils.nix {
inherit pkgs; inherit pkgs;
inherit (mainPackages.binutils-or1k) version src; inherit (mainPackages.binutils-or1k) version src;
@ -119,9 +118,9 @@ let
inherit pkgs conda-llvm-or1k; inherit pkgs conda-llvm-or1k;
inherit (mainPackages.llvmlite-artiq) version src; inherit (mainPackages.llvmlite-artiq) version src;
}; };
}); };
condaWindows5 = { condaWindowsLegacy = {
conda-windows-binutils-or1k = import ./conda-windows/redistribute.nix { conda-windows-binutils-or1k = import ./conda-windows/redistribute.nix {
inherit pkgs; inherit pkgs;
name = "binutils-or1k"; name = "binutils-or1k";
@ -145,7 +144,7 @@ let
}; };
}; };
condaWindows6 = rec { condaWindowsExperimental = rec {
conda-windows-binutils-or1k = import ./conda-windows/binutils.nix { conda-windows-binutils-or1k = import ./conda-windows/binutils.nix {
inherit pkgs; inherit pkgs;
inherit (mainPackages.binutils-or1k) version src; inherit (mainPackages.binutils-or1k) version src;
@ -167,6 +166,6 @@ let
}; };
}; };
condaWindows = if artiq6 then (if artiq7 then {} else condaWindows6) else condaWindows5; condaWindows = if artiq6 then condaWindowsExperimental else condaWindowsLegacy;
in in
boardPackages // mainPackages // condaNoarch // condaLinux // condaWindows boardPackages // mainPackages // condaNoarch // condaLinux // condaWindows

View File

@ -1,6 +1,4 @@
{ stdenv, lib, pythonDeps, fetchgit, git, python3Packages, qt5, libartiq-support, lit, outputcheck, fontconfig, { stdenv, lib, pythonDeps, fetchgit, git, python3Packages, qt5, binutils-or1k, binutils-arm, llvm-or1k, llvmlite-artiq, libartiq-support, lit, outputcheck, fontconfig }:
binutils-or1k, binutils-arm, llvm-or1k, llvmlite-artiq,
llvm_11, lld_11, llvmlite-llvm11 }:
python3Packages.buildPythonPackage rec { python3Packages.buildPythonPackage rec {
pname = "artiq"; pname = "artiq";
@ -10,12 +8,10 @@ python3Packages.buildPythonPackage rec {
preBuild = "export VERSIONEER_OVERRIDE=${version}"; preBuild = "export VERSIONEER_OVERRIDE=${version}";
nativeBuildInputs = [ qt5.wrapQtAppsHook ]; nativeBuildInputs = [ qt5.wrapQtAppsHook ];
propagatedBuildInputs = [ ] propagatedBuildInputs = [ binutils-or1k llvm-or1k llvmlite-artiq ]
++ (lib.lists.optionals (!lib.strings.versionAtLeast version "7.0") [ binutils-or1k llvm-or1k llvmlite-artiq ]) ++ (lib.lists.optionals (lib.strings.versionAtLeast version "6.0") [ binutils-arm ])
++ (lib.lists.optionals (lib.strings.versionAtLeast version "7.0") [ llvm_11 lld_11 llvmlite-llvm11 ]) ++ (with pythonDeps; [ sipyco pythonparser pyqtgraph])
++ (lib.lists.optionals (lib.strings.versionAtLeast version "6.0" && !lib.strings.versionAtLeast version "7.0") [ binutils-arm ]) ++ (with python3Packages; [ pygit2 numpy dateutil scipy prettytable pyserial python-Levenshtein h5py pyqt5 ])
++ (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)]; ++ [(if (lib.strings.versionAtLeast version "6.0") then pythonDeps.qasync else python3Packages.quamash)];
dontWrapQtApps = true; dontWrapQtApps = true;
@ -32,14 +28,14 @@ python3Packages.buildPythonPackage rec {
"--set FONTCONFIG_FILE ${fontconfig.out}/etc/fonts/fonts.conf" "--set FONTCONFIG_FILE ${fontconfig.out}/etc/fonts/fonts.conf"
]; ];
checkInputs = [ lit outputcheck ] ++ (if (lib.strings.versionAtLeast version "7.0") then [ lld_11 llvm_11 ] else [ binutils-or1k ]); checkInputs = [ binutils-or1k outputcheck ];
checkPhase = checkPhase =
'' ''
python -m unittest discover -v artiq.test python -m unittest discover -v artiq.test
TESTDIR=`mktemp -d` TESTDIR=`mktemp -d`
cp --no-preserve=mode,ownership -R $src/artiq/test/lit $TESTDIR cp --no-preserve=mode,ownership -R ${src}/artiq/test/lit $TESTDIR
LIBARTIQ_SUPPORT=${libartiq-support}/libartiq_support.so lit -v $TESTDIR/lit LIBARTIQ_SUPPORT=${libartiq-support}/libartiq_support.so ${lit}/bin/lit -v $TESTDIR/lit
''; '';

View File

@ -14,6 +14,13 @@ rec {
propagatedBuildInputs = with python3Packages; [ numpy ]; propagatedBuildInputs = with python3Packages; [ numpy ];
}; };
artiq_tools = python3Packages.buildPythonPackage rec {
pname = "artiq_tools";
version = "0.2";
src = /home/thomp/scratch/artiq_tools;
propagatedBuildInputs = with python3Packages; [ numpy typing ];
};
asyncserial = python3Packages.buildPythonPackage rec { asyncserial = python3Packages.buildPythonPackage rec {
pname = "asyncserial"; pname = "asyncserial";
version = "0.1"; version = "0.1";
@ -57,6 +64,20 @@ rec {
''; '';
}; };
pyqtgraph = python3Packages.buildPythonPackage rec {
pname = "pyqtgraph";
version = "0.12.3";
src = fetchFromGitHub {
rev = "123717df28ee91c0472ce939175c1b14bc1e4364";
owner = "jkthompsonlab";
repo = "pyqtgraph";
sha256 = "sha256-8RO2rl0/isS2/Ad5oAcuvaabg/wSoXGsL3PJdmGCfk4=";
};
propagatedBuildInputs = with python3Packages; [ numpy setuptools ];
doCheck = false;
};
# Development/firmware dependencies # Development/firmware dependencies
artiq-netboot = python3Packages.buildPythonPackage rec { artiq-netboot = python3Packages.buildPythonPackage rec {
pname = "artiq-netboot"; pname = "artiq-netboot";
@ -71,14 +92,14 @@ rec {
misoc = python3Packages.buildPythonPackage { misoc = python3Packages.buildPythonPackage {
pname = "misoc"; pname = "misoc";
version = if misoc-new then "unstable-2021-10-10" else "unstable-2021-02-15"; version = if misoc-new then "unstable-2021-09-10" else "unstable-2021-02-15";
src = if misoc-new src = if misoc-new
then (fetchFromGitHub { then (fetchFromGitHub {
owner = "m-labs"; owner = "m-labs";
repo = "misoc"; repo = "misoc";
rev = "f5203e406520874e15ab5d070058ef642fc57fd9"; rev = "c9572e777febf7abcfbebf624e0323d82600f267";
sha256 = "sha256-/2XTejqj0Bo81HaTrlTSWwInnWwsuqnq+CURXbpIrkA="; sha256 = "sha256-dal999XLFvS8Ol1hZnQjx7q/UfAXkzSMhAWcZKCDPx4=";
fetchSubmodules = true; fetchSubmodules = true;
}) })
else (fetchFromGitHub { else (fetchFromGitHub {
@ -104,13 +125,13 @@ rec {
migen = python3Packages.buildPythonPackage rec { migen = python3Packages.buildPythonPackage rec {
pname = "migen"; pname = "migen";
version = "unstable-2021-12-16"; version = "unstable-2021-08-10";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "m-labs"; owner = "m-labs";
repo = "migen"; repo = "migen";
rev = "ac703010eaa06ac9b6e32f97c6fa98b15de22b31"; rev = "27dbf03edd75c32dc1706e2a1316950c3a8d452a";
sha256 = "sha256-qpVj/yJf4hDDc99XXpVPH4EbLC8aCmEtACn5qNc3DGI="; sha256 = "0c7c7bbc05cb8xvxd612cxr7mvsxhaim0apfh7ax32wi9ykpl1ad";
}; };
propagatedBuildInputs = with python3Packages; [ colorama ]; propagatedBuildInputs = with python3Packages; [ colorama ];
@ -213,13 +234,13 @@ rec {
migen-axi = python3Packages.buildPythonPackage { migen-axi = python3Packages.buildPythonPackage {
pname = "migen-axi"; pname = "migen-axi";
version = "unstable-2021-09-15"; version = "unstable-2021-08-23";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "peteut"; owner = "peteut";
repo = "migen-axi"; repo = "migen-axi";
rev = "9763505ee96acd7572280a2d1233721342dc7c3f"; rev = "1f94ee0fc847dad118020bfc8c6a8f26ed9958bd";
sha256 = "15c7g05n183rka66fl1glzp6h7xjlpy1p6k8biry24dangsmxmvg"; sha256 = "0bk4g8k7cng8na01p7h6llrfpjkmxsamyi1kacvk3n110l2kl93g";
}; };
nativeBuildInputs = [ python3Packages.pbr ]; nativeBuildInputs = [ python3Packages.pbr ];
@ -227,7 +248,7 @@ rec {
postPatch = '' postPatch = ''
substituteInPlace requirements.txt \ substituteInPlace requirements.txt \
--replace "jinja2==2.11.3" "jinja2" --replace "jinja2==2.10.3" "jinja2"
substituteInPlace requirements.txt \ substituteInPlace requirements.txt \
--replace "future==0.18.2" "future" --replace "future==0.18.2" "future"
substituteInPlace requirements.txt \ substituteInPlace requirements.txt \

View File

@ -1,21 +1,87 @@
{ pkgs ? import <nixpkgs> {}}: { pkgs ? import <nixpkgs> {}}:
with import <nixpkgs> {};
let let
set-scratch-dir = ./set-scratch-dir.sh;
artiqpkgs = import ./default.nix { inherit pkgs; }; artiqpkgs = import ./default.nix { inherit pkgs; };
vivado = import ./vivado.nix { inherit pkgs; }; vivado = import ./vivado.nix { inherit pkgs; };
sipyco = python3Packages.buildPythonPackage rec {
pname = "sipyco";
version = "0.1";
src = /home/thomp/scratch/sipyco;
propagatedBuildInputs = [ pkgs.python3Packages.statsmodels ];
doCheck = false;
};
artiq_tools = python3Packages.buildPythonPackage rec {
pname = "artiq_tools";
version = "0.2";
src = /home/thomp/scratch/artiq_tools;
propagatedBuildInputs = [ pkgs.python3Packages.numpy pkgs.python3Packages.typing artiqpkgs.artiq pkgs.python3Packages.pyzmq pkgs.python3Packages.matplotlib];
};
oitg = python3Packages.buildPythonPackage rec {
pname = "oitg";
version = "0.1";
src = /home/thomp/scratch/oitg;
propagatedBuildInputs = [ pkgs.python3Packages.statsmodels ];
doCheck = false;
};
python_library = python3Packages.buildPythonPackage rec {
pname = "python_library";
version = "0.1";
src = /home/thomp/scratch/python-library;
propagatedBuildInputs = [ pkgs.python3Packages.numpy pkgs.python3Packages.scipy pkgs.python3Packages.matplotlib ];
};
strontium_library = python3Packages.buildPythonPackage rec {
pname = "strontium_library";
version = "0.1";
src = /home/thomp/scratch/strontium-library;
propagatedBuildInputs = [ pkgs.python3Packages.numpy pkgs.python3Packages.scipy pkgs.python3Packages.matplotlib pkgs.python3Packages.influxdb];
};
ndscan = python3Packages.buildPythonPackage rec {
pname = "ndscan";
version = "0.1";
src = /home/thomp/scratch/ndscan;
propagatedBuildInputs = [ artiqpkgs.artiq oitg];
doCheck = false;
};
analysis_library = python3Packages.buildPythonPackage rec {
pname = "analysis_library";
version = "0.1";
src = /home/thomp/scratch/analysis-library;
propagatedBuildInputs = [ pkgs.python3Packages.h5py pkgs.python3Packages.matplotlib pkgs.python3Packages.scipy pkgs.python3Packages.numpy python_library strontium_library pkgs.python3Packages.uncertainties];
doCheck = false;
};
in in
assert pkgs.lib.asserts.assertMsg (!pkgs.lib.strings.versionAtLeast artiqpkgs.artiq.version "7.0") "For ARTIQ 7+, use 'nix develop' on the flake instead.";
pkgs.mkShell { pkgs.mkShell {
buildInputs = [ buildInputs = [
vivado vivado
sipyco
artiq_tools
analysis_library
python_library
strontium_library
ndscan
pkgs.gnumake pkgs.gnumake
(pkgs.python3.withPackages(ps: (with ps; [ jinja2 jsonschema numpy paramiko ]) ++ (with artiqpkgs; [ migen microscope misoc jesd204b migen-axi artiq ]))) (pkgs.python3.withPackages(ps: (with ps; [ jinja2 jsonschema numpy paramiko ]) ++ (with artiqpkgs; [ migen microscope misoc jesd204b migen-axi artiq ])))
artiqpkgs.cargo-legacy artiqpkgs.cargo
artiqpkgs.rustc-legacy artiqpkgs.rustc
artiqpkgs.binutils-or1k artiqpkgs.binutils-or1k
artiqpkgs.binutils-arm artiqpkgs.binutils-arm
artiqpkgs.llvm-or1k artiqpkgs.llvm-or1k
artiqpkgs.openocd artiqpkgs.openocd
]; ];
shellHook = ''
source ${set-scratch-dir};
export PYTHONPATH="$scratch_dir/artiq_tools:$PYTHONPATH"
export PYTHONPATH="$scratch_dir/oitg:$PYTHONPATH"
export PYTHONPATH="$scratch_dir/analysis-library:$PYTHONPATH"
export PYTHONPATH="$scratch_dir/python-library:$PYTHONPATH"
export PYTHONPATH="$scratch_dir/strontium-library:$PYTHONPATH"
export PYTHONPATH="$scratch_dir/ndscan:$PYTHONPATH"
export PYTHONPATH="$scratch_dir/sipyco:$PYTHONPATH"
'';
TARGET_AR="or1k-linux-ar"; TARGET_AR="or1k-linux-ar";
} }