2021-08-12 12:44:42 +08:00
|
|
|
{
|
|
|
|
description = "A leading-edge control system for quantum information experiments";
|
|
|
|
|
2022-05-31 18:24:47 +08:00
|
|
|
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-22.05;
|
2021-08-16 14:53:15 +08:00
|
|
|
inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; };
|
2022-02-12 10:59:10 +08:00
|
|
|
inputs.sipyco.url = github:m-labs/sipyco;
|
|
|
|
inputs.sipyco.inputs.nixpkgs.follows = "nixpkgs";
|
2021-08-12 12:44:42 +08:00
|
|
|
inputs.src-pythonparser = { url = github:m-labs/pythonparser; flake = false; };
|
2022-02-13 17:15:25 +08:00
|
|
|
inputs.artiq-comtools.url = github:m-labs/artiq-comtools;
|
|
|
|
inputs.artiq-comtools.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.artiq-comtools.inputs.sipyco.follows = "sipyco";
|
2021-08-12 12:44:42 +08:00
|
|
|
|
2021-08-16 16:38:55 +08:00
|
|
|
inputs.src-migen = { url = github:m-labs/migen; flake = false; };
|
2021-08-25 12:49:18 +08:00
|
|
|
inputs.src-misoc = { type = "git"; url = "https://github.com/m-labs/misoc.git"; submodules = true; flake = false; };
|
2021-08-16 16:38:55 +08:00
|
|
|
|
2022-02-13 17:15:25 +08:00
|
|
|
outputs = { self, nixpkgs, mozilla-overlay, sipyco, src-pythonparser, artiq-comtools, src-migen, src-misoc }:
|
2021-08-16 14:53:15 +08:00
|
|
|
let
|
|
|
|
pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import mozilla-overlay) ]; };
|
2022-07-08 11:35:17 +08:00
|
|
|
pkgs-aarch64 = import nixpkgs { system = "aarch64-linux"; };
|
2022-01-19 19:58:55 +08:00
|
|
|
|
|
|
|
artiqVersionMajor = 7;
|
|
|
|
artiqVersionMinor = self.sourceInfo.revCount or 0;
|
|
|
|
artiqVersionId = self.sourceInfo.shortRev or "unknown";
|
2022-07-08 18:20:23 +08:00
|
|
|
artiqVersion = (builtins.toString artiqVersionMajor) + "." + (builtins.toString artiqVersionMinor) + "." + artiqVersionId;
|
2022-02-08 21:05:39 +08:00
|
|
|
artiqRev = self.sourceInfo.rev or "unknown";
|
2022-01-19 19:58:55 +08:00
|
|
|
|
2021-08-16 14:53:15 +08:00
|
|
|
rustManifest = pkgs.fetchurl {
|
|
|
|
url = "https://static.rust-lang.org/dist/2021-01-29/channel-rust-nightly.toml";
|
|
|
|
sha256 = "sha256-EZKgw89AH4vxaJpUHmIMzMW/80wAFQlfcxRoBD9nz0c=";
|
2021-08-12 12:44:42 +08:00
|
|
|
};
|
2021-09-10 17:19:32 +08:00
|
|
|
|
2021-08-16 14:53:15 +08:00
|
|
|
targets = [];
|
|
|
|
rustChannelOfTargets = _channel: _date: targets:
|
|
|
|
(pkgs.lib.rustLib.fromManifestFile rustManifest {
|
|
|
|
inherit (pkgs) stdenv lib fetchurl patchelf;
|
|
|
|
}).rust.override {
|
|
|
|
inherit targets;
|
|
|
|
extensions = ["rust-src"];
|
|
|
|
};
|
|
|
|
rust = rustChannelOfTargets "nightly" null targets;
|
|
|
|
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
|
|
|
|
rustc = rust;
|
|
|
|
cargo = rust;
|
|
|
|
});
|
2021-09-10 17:19:32 +08:00
|
|
|
|
2021-08-25 13:22:44 +08:00
|
|
|
vivadoDeps = pkgs: with pkgs; [
|
|
|
|
ncurses5
|
|
|
|
zlib
|
|
|
|
libuuid
|
|
|
|
xorg.libSM
|
|
|
|
xorg.libICE
|
|
|
|
xorg.libXrender
|
|
|
|
xorg.libX11
|
|
|
|
xorg.libXext
|
|
|
|
xorg.libXtst
|
|
|
|
xorg.libXi
|
2021-10-27 17:01:03 +08:00
|
|
|
freetype
|
|
|
|
fontconfig
|
2021-08-25 13:22:44 +08:00
|
|
|
];
|
2021-08-12 12:44:42 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
pythonparser = pkgs.python3Packages.buildPythonPackage {
|
2022-02-12 17:48:35 +08:00
|
|
|
pname = "pythonparser";
|
|
|
|
version = "1.4";
|
2021-09-10 17:19:32 +08:00
|
|
|
src = src-pythonparser;
|
|
|
|
doCheck = false;
|
|
|
|
propagatedBuildInputs = with pkgs.python3Packages; [ regex ];
|
|
|
|
};
|
2021-08-12 12:44:42 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
qasync = pkgs.python3Packages.buildPythonPackage rec {
|
|
|
|
pname = "qasync";
|
2022-01-19 20:44:50 +08:00
|
|
|
version = "0.19.0";
|
2021-09-10 17:19:32 +08:00
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "CabbageDevelopment";
|
|
|
|
repo = "qasync";
|
|
|
|
rev = "v${version}";
|
2022-01-19 20:44:50 +08:00
|
|
|
sha256 = "sha256-xGAUAyOq+ELwzMGbLLmXijxLG8pv4a6tPvfAVOt1YwU=";
|
2021-08-12 12:44:42 +08:00
|
|
|
};
|
2021-09-10 17:19:32 +08:00
|
|
|
propagatedBuildInputs = [ pkgs.python3Packages.pyqt5 ];
|
|
|
|
checkInputs = [ pkgs.python3Packages.pytest ];
|
|
|
|
checkPhase = ''
|
|
|
|
pytest -k 'test_qthreadexec.py' # the others cause the test execution to be aborted, I think because of asyncio
|
|
|
|
'';
|
|
|
|
};
|
2021-08-12 12:44:42 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
outputcheck = pkgs.python3Packages.buildPythonApplication rec {
|
|
|
|
pname = "outputcheck";
|
|
|
|
version = "0.4.2";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "stp";
|
|
|
|
repo = "OutputCheck";
|
|
|
|
rev = "e0f533d3c5af2949349856c711bf4bca50022b48";
|
|
|
|
sha256 = "1y27vz6jq6sywas07kz3v01sqjd0sga9yv9w2cksqac3v7wmf2a0";
|
2021-08-16 14:53:15 +08:00
|
|
|
};
|
2021-09-10 17:19:32 +08:00
|
|
|
prePatch = "echo ${version} > RELEASE-VERSION";
|
|
|
|
};
|
2021-08-12 12:44:42 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
libartiq-support = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "libartiq-support";
|
|
|
|
src = self;
|
|
|
|
buildInputs = [ rustPlatform.rust.rustc ];
|
|
|
|
buildPhase = ''
|
|
|
|
rustc $src/artiq/test/libartiq_support/lib.rs -Cpanic=unwind -g
|
|
|
|
'';
|
|
|
|
installPhase = ''
|
2022-02-02 16:33:17 +08:00
|
|
|
mkdir -p $out/lib $out/bin
|
|
|
|
cp libartiq_support.so $out/lib
|
|
|
|
cat > $out/bin/libartiq-support << EOF
|
|
|
|
#!/bin/sh
|
|
|
|
echo $out/lib/libartiq_support.so
|
|
|
|
EOF
|
|
|
|
chmod 755 $out/bin/libartiq-support
|
2021-09-10 17:19:32 +08:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
llvmlite-new = pkgs.python3Packages.buildPythonPackage rec {
|
|
|
|
pname = "llvmlite";
|
2022-02-24 01:54:59 +08:00
|
|
|
version = "0.38.0";
|
2021-09-10 17:19:32 +08:00
|
|
|
src = pkgs.python3Packages.fetchPypi {
|
2021-11-08 16:55:29 +08:00
|
|
|
inherit pname;
|
2022-02-24 01:54:59 +08:00
|
|
|
version = "0.38.0";
|
|
|
|
sha256 = "qZ0WbM87EW87ntI7m3C6JBVkCpyXjzqqE/rUnFj0llw=";
|
2021-08-16 16:38:55 +08:00
|
|
|
};
|
2021-09-10 17:19:32 +08:00
|
|
|
nativeBuildInputs = [ pkgs.llvm_11 ];
|
|
|
|
# Disable static linking
|
|
|
|
# https://github.com/numba/llvmlite/issues/93
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace ffi/Makefile.linux --replace "-static-libstdc++" ""
|
|
|
|
substituteInPlace llvmlite/tests/test_binding.py --replace "test_linux" "nope"
|
|
|
|
'';
|
|
|
|
# Set directory containing llvm-config binary
|
|
|
|
preConfigure = ''
|
|
|
|
export LLVM_CONFIG=${pkgs.llvm_11.dev}/bin/llvm-config
|
|
|
|
'';
|
|
|
|
doCheck = false; # FIXME
|
|
|
|
};
|
2021-08-16 16:38:55 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
artiq = pkgs.python3Packages.buildPythonPackage rec {
|
|
|
|
pname = "artiq";
|
2022-01-19 19:58:55 +08:00
|
|
|
version = artiqVersion;
|
2021-09-10 17:19:32 +08:00
|
|
|
src = self;
|
2021-08-12 12:44:42 +08:00
|
|
|
|
2022-02-08 21:05:39 +08:00
|
|
|
preBuild =
|
|
|
|
''
|
|
|
|
export VERSIONEER_OVERRIDE=${version}
|
|
|
|
export VERSIONEER_REV=${artiqRev}
|
|
|
|
'';
|
2021-08-12 12:44:42 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
|
|
|
|
# keep llvm_x and lld_x in sync with llvmlite
|
2022-02-13 17:15:25 +08:00
|
|
|
propagatedBuildInputs = [ pkgs.llvm_11 pkgs.lld_11 llvmlite-new sipyco.packages.x86_64-linux.sipyco pythonparser artiq-comtools.packages.x86_64-linux.artiq-comtools ]
|
2022-05-18 19:04:13 +08:00
|
|
|
++ (with pkgs.python3Packages; [ pyqtgraph pygit2 numpy dateutil scipy prettytable pyserial python-Levenshtein h5py pyqt5 qasync tqdm ]);
|
2021-08-12 12:44:42 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
dontWrapQtApps = true;
|
|
|
|
postFixup = ''
|
|
|
|
wrapQtApp "$out/bin/artiq_dashboard"
|
|
|
|
wrapQtApp "$out/bin/artiq_browser"
|
|
|
|
wrapQtApp "$out/bin/artiq_session"
|
|
|
|
'';
|
2021-08-12 12:44:42 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
# 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 ${pkgs.fontconfig.out}/etc/fonts/fonts.conf"
|
|
|
|
];
|
2021-08-12 12:44:42 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
# FIXME: automatically propagate lld_11 llvm_11 dependencies
|
2022-02-02 16:33:17 +08:00
|
|
|
checkInputs = [ pkgs.lld_11 pkgs.llvm_11 libartiq-support pkgs.lit outputcheck ];
|
2021-09-10 17:19:32 +08:00
|
|
|
checkPhase = ''
|
|
|
|
python -m unittest discover -v artiq.test
|
2021-08-12 12:44:42 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
TESTDIR=`mktemp -d`
|
|
|
|
cp --no-preserve=mode,ownership -R $src/artiq/test/lit $TESTDIR
|
2022-02-02 16:33:17 +08:00
|
|
|
LIBARTIQ_SUPPORT=`libartiq-support` lit -v $TESTDIR/lit
|
2021-09-10 17:19:32 +08:00
|
|
|
'';
|
|
|
|
};
|
2021-08-16 16:38:55 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
migen = pkgs.python3Packages.buildPythonPackage rec {
|
|
|
|
name = "migen";
|
|
|
|
src = src-migen;
|
|
|
|
propagatedBuildInputs = [ pkgs.python3Packages.colorama ];
|
|
|
|
};
|
2021-08-16 16:38:55 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
asyncserial = pkgs.python3Packages.buildPythonPackage rec {
|
|
|
|
pname = "asyncserial";
|
|
|
|
version = "0.1";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "m-labs";
|
|
|
|
repo = "asyncserial";
|
|
|
|
rev = "d95bc1d6c791b0e9785935d2f62f628eb5cdf98d";
|
|
|
|
sha256 = "0yzkka9jk3612v8gx748x6ziwykq5lr7zmr9wzkcls0v2yilqx9k";
|
2021-08-16 16:38:55 +08:00
|
|
|
};
|
2021-09-10 17:19:32 +08:00
|
|
|
propagatedBuildInputs = [ pkgs.python3Packages.pyserial ];
|
|
|
|
};
|
2021-08-16 16:38:55 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
misoc = pkgs.python3Packages.buildPythonPackage {
|
|
|
|
name = "misoc";
|
|
|
|
src = src-misoc;
|
|
|
|
doCheck = false; # TODO: fix misoc bitrot and re-enable tests
|
|
|
|
propagatedBuildInputs = with pkgs.python3Packages; [ jinja2 numpy migen pyserial asyncserial ];
|
|
|
|
};
|
|
|
|
|
2021-10-07 17:20:44 +08:00
|
|
|
jesd204b = pkgs.python3Packages.buildPythonPackage rec {
|
|
|
|
pname = "jesd204b";
|
|
|
|
version = "unstable-2021-05-05";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "m-labs";
|
|
|
|
repo = "jesd204b";
|
|
|
|
rev = "bf1cd9014c8b7a9db67609f653634daaf3bcd39b";
|
|
|
|
sha256 = "sha256-wyYOCRIPANReeCl+KaIpiAStsn2mzfMlK+cSrUzVrAw=";
|
|
|
|
};
|
|
|
|
propagatedBuildInputs = with pkgs.python3Packages; [ migen misoc ];
|
|
|
|
};
|
|
|
|
|
2021-10-08 12:13:58 +08:00
|
|
|
microscope = pkgs.python3Packages.buildPythonPackage rec {
|
|
|
|
pname = "microscope";
|
|
|
|
version = "unstable-2020-12-28";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "m-labs";
|
|
|
|
repo = "microscope";
|
|
|
|
rev = "c21afe7a53258f05bde57e5ebf2e2761f3d495e4";
|
|
|
|
sha256 = "sha256-jzyiLRuEf7p8LdhmZvOQj/dyQx8eUE8p6uRlwoiT8vg=";
|
|
|
|
};
|
|
|
|
propagatedBuildInputs = with pkgs.python3Packages; [ pyserial prettytable msgpack migen ];
|
|
|
|
};
|
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
cargo-xbuild = rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "cargo-xbuild";
|
|
|
|
version = "0.6.5";
|
|
|
|
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "rust-osdev";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "18djvygq9v8rmfchvi2hfj0i6fhn36m716vqndqnj56fiqviwxvf";
|
2021-08-16 16:38:55 +08:00
|
|
|
};
|
2021-08-12 12:44:42 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
cargoSha256 = "13sj9j9kl6js75h9xq0yidxy63vixxm9q3f8jil6ymarml5wkhx8";
|
|
|
|
};
|
2021-09-01 17:45:27 +08:00
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
vivadoEnv = pkgs.buildFHSUserEnv {
|
|
|
|
name = "vivado-env";
|
|
|
|
targetPkgs = vivadoDeps;
|
|
|
|
};
|
|
|
|
|
|
|
|
vivado = pkgs.buildFHSUserEnv {
|
|
|
|
name = "vivado";
|
|
|
|
targetPkgs = vivadoDeps;
|
2022-03-20 16:09:58 +08:00
|
|
|
profile = "set -e; source /opt/Xilinx/Vivado/2021.2/settings64.sh";
|
2021-09-10 17:19:32 +08:00
|
|
|
runScript = "vivado";
|
|
|
|
};
|
|
|
|
|
|
|
|
makeArtiqBoardPackage = { target, variant, buildCommand ? "python -m artiq.gateware.targets.${target} -V ${variant}" }:
|
2022-02-14 15:54:17 +08:00
|
|
|
pkgs.stdenv.mkDerivation {
|
2021-09-10 17:19:32 +08:00
|
|
|
name = "artiq-board-${target}-${variant}";
|
|
|
|
phases = [ "buildPhase" "checkPhase" "installPhase" ];
|
2022-04-24 14:02:59 +08:00
|
|
|
cargoDeps = rustPlatform.importCargoLock {
|
|
|
|
lockFile = ./artiq/firmware/Cargo.lock;
|
|
|
|
outputHashes = {
|
|
|
|
"fringe-1.2.1" = "sha256-m4rzttWXRlwx53LWYpaKuU5AZe4GSkbjHS6oINt5d3Y=";
|
|
|
|
};
|
2021-09-01 17:45:27 +08:00
|
|
|
};
|
2021-09-10 17:19:32 +08:00
|
|
|
nativeBuildInputs = [
|
2022-01-30 19:38:56 +08:00
|
|
|
(pkgs.python3.withPackages(ps: [ ps.jsonschema migen misoc artiq]))
|
2021-09-10 17:19:32 +08:00
|
|
|
rustPlatform.rust.rustc
|
|
|
|
rustPlatform.rust.cargo
|
|
|
|
pkgs.llvmPackages_11.clang-unwrapped
|
|
|
|
pkgs.llvm_11
|
|
|
|
pkgs.lld_11
|
|
|
|
vivado
|
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
cargo-xbuild
|
|
|
|
];
|
|
|
|
buildPhase =
|
|
|
|
''
|
|
|
|
ARTIQ_PATH=`python -c "import artiq; print(artiq.__path__[0])"`
|
|
|
|
ln -s $ARTIQ_PATH/firmware/Cargo.lock .
|
|
|
|
cargoSetupPostUnpackHook
|
|
|
|
cargoSetupPostPatchHook
|
|
|
|
${buildCommand}
|
|
|
|
'';
|
2021-10-18 11:09:10 +08:00
|
|
|
doCheck = true;
|
|
|
|
checkPhase =
|
|
|
|
''
|
2021-09-10 17:19:32 +08:00
|
|
|
# Search for PCREs in the Vivado output to check for errors
|
|
|
|
check_log() {
|
|
|
|
grep -Pe "$1" artiq_${target}/${variant}/gateware/vivado.log && exit 1 || true
|
|
|
|
}
|
|
|
|
check_log "\d+ constraint not met\."
|
|
|
|
check_log "Timing constraints are not met\."
|
|
|
|
'';
|
|
|
|
installPhase =
|
|
|
|
''
|
2022-02-14 15:54:17 +08:00
|
|
|
TARGET_DIR=$out
|
2021-09-10 17:19:32 +08:00
|
|
|
mkdir -p $TARGET_DIR
|
|
|
|
cp artiq_${target}/${variant}/gateware/top.bit $TARGET_DIR
|
|
|
|
if [ -e artiq_${target}/${variant}/software/bootloader/bootloader.bin ]
|
|
|
|
then cp artiq_${target}/${variant}/software/bootloader/bootloader.bin $TARGET_DIR
|
|
|
|
fi
|
|
|
|
if [ -e artiq_${target}/${variant}/software/runtime ]
|
|
|
|
then cp artiq_${target}/${variant}/software/runtime/runtime.{elf,fbi} $TARGET_DIR
|
|
|
|
else cp artiq_${target}/${variant}/software/satman/satman.{elf,fbi} $TARGET_DIR
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
# don't mangle ELF files as they are not for NixOS
|
|
|
|
dontFixup = true;
|
2022-02-14 15:54:17 +08:00
|
|
|
};
|
2021-09-01 17:45:27 +08:00
|
|
|
|
2022-07-08 11:35:17 +08:00
|
|
|
openocd-bscanspi-f = pkgs: let
|
2021-09-10 17:19:32 +08:00
|
|
|
bscan_spi_bitstreams-pkg = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "bscan_spi_bitstreams";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "quartiq";
|
|
|
|
repo = "bscan_spi_bitstreams";
|
|
|
|
rev = "01d8f819f15baf9a8cc5d96945a51e4d267ff564";
|
|
|
|
sha256 = "1zqv47kzgvbn4c8cr019a6wcja7gn5h1z4kvw5bhpc72fyhagal9";
|
|
|
|
};
|
|
|
|
phases = ["installPhase"];
|
|
|
|
installPhase =
|
|
|
|
''
|
|
|
|
mkdir -p $out/share/bscan-spi-bitstreams
|
|
|
|
cp $src/*.bit $out/share/bscan-spi-bitstreams
|
|
|
|
'';
|
2021-09-01 17:45:27 +08:00
|
|
|
};
|
2021-09-10 17:19:32 +08:00
|
|
|
# https://docs.lambdaconcept.com/screamer/troubleshooting.html#error-contents-differ
|
|
|
|
openocd-fixed = pkgs.openocd.overrideAttrs(oa: {
|
2021-09-27 09:31:49 +08:00
|
|
|
version = "unstable-2021-09-15";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "openocd-org";
|
|
|
|
repo = "openocd";
|
|
|
|
rev = "a0bd3c9924870c3b8f428648410181040dabc33c";
|
|
|
|
sha256 = "sha256-YgUsl4/FohfsOncM4uiz/3c6g2ZN4oZ0y5vV/2Skwqg=";
|
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
2022-05-31 18:24:47 +08:00
|
|
|
patches = [
|
2021-09-10 17:19:32 +08:00
|
|
|
(pkgs.fetchurl {
|
2021-09-27 09:31:49 +08:00
|
|
|
url = "https://git.m-labs.hk/M-Labs/nix-scripts/raw/commit/575ef05cd554c239e4cc8cb97ae4611db458a80d/artiq-fast/pkgs/openocd-jtagspi.diff";
|
|
|
|
sha256 = "0g3crk8gby42gm661yxdcgapdi8sp050l5pb2d0yjfic7ns9cw81";
|
2021-09-10 17:19:32 +08:00
|
|
|
})
|
|
|
|
];
|
2021-09-27 09:31:49 +08:00
|
|
|
nativeBuildInputs = oa.nativeBuildInputs or [] ++ [ pkgs.autoreconfHook269 ];
|
2021-09-10 17:19:32 +08:00
|
|
|
});
|
|
|
|
in pkgs.buildEnv {
|
|
|
|
name = "openocd-bscanspi";
|
|
|
|
paths = [ openocd-fixed bscan_spi_bitstreams-pkg ];
|
|
|
|
};
|
2022-02-09 10:53:52 +08:00
|
|
|
|
|
|
|
sphinxcontrib-wavedrom = pkgs.python3Packages.buildPythonPackage rec {
|
|
|
|
pname = "sphinxcontrib-wavedrom";
|
|
|
|
version = "3.0.2";
|
|
|
|
src = pkgs.python3Packages.fetchPypi {
|
|
|
|
inherit pname version;
|
|
|
|
sha256 = "sha256-ukZd3ajt0Sx3LByof4R80S31F5t1yo+L8QUADrMMm2A=";
|
|
|
|
};
|
|
|
|
buildInputs = [ pkgs.python3Packages.setuptools_scm ];
|
2022-06-01 20:45:49 +08:00
|
|
|
propagatedBuildInputs = (with pkgs.python3Packages; [ wavedrom sphinx xcffib cairosvg ]);
|
2022-02-09 10:53:52 +08:00
|
|
|
};
|
2022-02-11 14:36:18 +08:00
|
|
|
latex-artiq-manual = pkgs.texlive.combine {
|
2022-02-09 10:53:52 +08:00
|
|
|
inherit (pkgs.texlive)
|
|
|
|
scheme-basic latexmk cmap collection-fontsrecommended fncychap
|
|
|
|
titlesec tabulary varwidth framed fancyvrb float wrapfig parskip
|
|
|
|
upquote capt-of needspace etoolbox;
|
|
|
|
};
|
2021-09-10 17:19:32 +08:00
|
|
|
in rec {
|
2022-02-11 14:36:18 +08:00
|
|
|
packages.x86_64-linux = {
|
2022-07-08 11:35:17 +08:00
|
|
|
inherit pythonparser qasync artiq;
|
2022-02-11 14:36:18 +08:00
|
|
|
inherit migen misoc asyncserial microscope vivadoEnv vivado;
|
2022-07-08 11:35:17 +08:00
|
|
|
openocd-bscanspi = openocd-bscanspi-f pkgs;
|
2021-09-10 17:19:32 +08:00
|
|
|
artiq-board-kc705-nist_clock = makeArtiqBoardPackage {
|
|
|
|
target = "kc705";
|
|
|
|
variant = "nist_clock";
|
2021-08-25 13:22:44 +08:00
|
|
|
};
|
2022-02-11 14:36:18 +08:00
|
|
|
inherit sphinxcontrib-wavedrom latex-artiq-manual;
|
|
|
|
artiq-manual-html = pkgs.stdenvNoCC.mkDerivation rec {
|
|
|
|
name = "artiq-manual-html-${version}";
|
|
|
|
version = artiqVersion;
|
|
|
|
src = self;
|
|
|
|
buildInputs = [
|
|
|
|
pkgs.python3Packages.sphinx pkgs.python3Packages.sphinx_rtd_theme
|
|
|
|
pkgs.python3Packages.sphinx-argparse sphinxcontrib-wavedrom
|
|
|
|
];
|
|
|
|
buildPhase = ''
|
|
|
|
export VERSIONEER_OVERRIDE=${artiqVersion}
|
2022-02-12 10:24:45 +08:00
|
|
|
export SOURCE_DATE_EPOCH=${builtins.toString self.sourceInfo.lastModified}
|
2022-02-11 14:36:18 +08:00
|
|
|
cd doc/manual
|
|
|
|
make html
|
|
|
|
'';
|
|
|
|
installPhase = ''
|
|
|
|
cp -r _build/html $out
|
|
|
|
mkdir $out/nix-support
|
|
|
|
echo doc manual $out index.html >> $out/nix-support/hydra-build-products
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
artiq-manual-pdf = pkgs.stdenvNoCC.mkDerivation rec {
|
|
|
|
name = "artiq-manual-pdf-${version}";
|
|
|
|
version = artiqVersion;
|
|
|
|
src = self;
|
|
|
|
buildInputs = [
|
|
|
|
pkgs.python3Packages.sphinx pkgs.python3Packages.sphinx_rtd_theme
|
|
|
|
pkgs.python3Packages.sphinx-argparse sphinxcontrib-wavedrom
|
|
|
|
latex-artiq-manual
|
|
|
|
];
|
|
|
|
buildPhase = ''
|
|
|
|
export VERSIONEER_OVERRIDE=${artiq.version}
|
|
|
|
export SOURCE_DATE_EPOCH=${builtins.toString self.sourceInfo.lastModified}
|
|
|
|
cd doc/manual
|
|
|
|
make latexpdf
|
|
|
|
'';
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
cp _build/latex/ARTIQ.pdf $out
|
|
|
|
mkdir $out/nix-support
|
|
|
|
echo doc-pdf manual $out ARTIQ.pdf >> $out/nix-support/hydra-build-products
|
|
|
|
'';
|
|
|
|
};
|
2021-08-25 12:49:05 +08:00
|
|
|
};
|
|
|
|
|
2022-01-30 19:31:20 +08:00
|
|
|
inherit makeArtiqBoardPackage;
|
|
|
|
|
2021-08-16 14:53:15 +08:00
|
|
|
defaultPackage.x86_64-linux = pkgs.python3.withPackages(ps: [ packages.x86_64-linux.artiq ]);
|
2021-08-16 16:38:55 +08:00
|
|
|
|
|
|
|
devShell.x86_64-linux = pkgs.mkShell {
|
|
|
|
name = "artiq-dev-shell";
|
|
|
|
buildInputs = [
|
2021-10-08 12:13:58 +08:00
|
|
|
(pkgs.python3.withPackages(ps: with packages.x86_64-linux; [ migen misoc jesd204b artiq ps.paramiko ps.jsonschema microscope ]))
|
2021-08-16 16:38:55 +08:00
|
|
|
rustPlatform.rust.rustc
|
|
|
|
rustPlatform.rust.cargo
|
2021-09-13 07:20:36 +08:00
|
|
|
cargo-xbuild
|
2021-08-16 16:38:55 +08:00
|
|
|
pkgs.llvmPackages_11.clang-unwrapped
|
|
|
|
pkgs.llvm_11
|
|
|
|
pkgs.lld_11
|
2022-04-22 06:47:23 +08:00
|
|
|
# To manually run compiler tests:
|
|
|
|
pkgs.lit
|
|
|
|
outputcheck
|
|
|
|
libartiq-support
|
2021-08-25 13:22:44 +08:00
|
|
|
# use the vivado-env command to enter a FHS shell that lets you run the Vivado installer
|
|
|
|
packages.x86_64-linux.vivadoEnv
|
|
|
|
packages.x86_64-linux.vivado
|
2021-09-02 11:18:58 +08:00
|
|
|
packages.x86_64-linux.openocd-bscanspi
|
2022-02-09 10:53:52 +08:00
|
|
|
pkgs.python3Packages.sphinx pkgs.python3Packages.sphinx_rtd_theme
|
2022-02-11 14:36:18 +08:00
|
|
|
pkgs.python3Packages.sphinx-argparse sphinxcontrib-wavedrom latex-artiq-manual
|
2021-08-16 16:38:55 +08:00
|
|
|
];
|
2022-04-22 06:47:23 +08:00
|
|
|
shellHook = ''
|
|
|
|
export LIBARTIQ_SUPPORT=`libartiq-support`
|
|
|
|
'';
|
2021-08-16 16:38:55 +08:00
|
|
|
};
|
2021-08-18 14:48:10 +08:00
|
|
|
|
2022-07-08 11:35:17 +08:00
|
|
|
packages.aarch64-linux = {
|
|
|
|
openocd-bscanspi = openocd-bscanspi-f pkgs-aarch64;
|
|
|
|
};
|
|
|
|
|
2021-08-18 14:48:10 +08:00
|
|
|
hydraJobs = {
|
2021-09-02 11:30:22 +08:00
|
|
|
inherit (packages.x86_64-linux) artiq artiq-board-kc705-nist_clock openocd-bscanspi;
|
|
|
|
kc705-hitl = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "kc705-hitl";
|
|
|
|
|
2022-05-26 12:00:40 +08:00
|
|
|
__networked = true; # compatibility with old patched Nix
|
2022-06-04 10:32:02 +08:00
|
|
|
# breaks hydra, https://github.com/NixOS/hydra/issues/1216
|
|
|
|
#__impure = true; # Nix 2.8+
|
2021-09-02 11:30:22 +08:00
|
|
|
|
|
|
|
buildInputs = [
|
2022-02-14 15:54:17 +08:00
|
|
|
(pkgs.python3.withPackages(ps: with packages.x86_64-linux; [ artiq ps.paramiko ]))
|
2021-09-02 11:42:01 +08:00
|
|
|
pkgs.llvm_11
|
2021-09-02 11:30:22 +08:00
|
|
|
pkgs.lld_11
|
|
|
|
pkgs.openssh
|
2021-09-02 11:31:34 +08:00
|
|
|
packages.x86_64-linux.openocd-bscanspi # for the bscanspi bitstreams
|
2021-09-02 11:30:22 +08:00
|
|
|
];
|
|
|
|
phases = [ "buildPhase" ];
|
|
|
|
buildPhase =
|
|
|
|
''
|
2021-12-03 17:16:54 +08:00
|
|
|
whoami
|
2021-09-02 11:30:22 +08:00
|
|
|
export HOME=`mktemp -d`
|
|
|
|
mkdir $HOME/.ssh
|
2021-12-03 18:34:49 +08:00
|
|
|
cp /opt/hydra_id_ed25519 $HOME/.ssh/id_ed25519
|
|
|
|
cp /opt/hydra_id_ed25519.pub $HOME/.ssh/id_ed25519.pub
|
2022-07-07 18:03:17 +08:00
|
|
|
echo "rpi-1 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIACtBFDVBYoAE4fpJCTANZSE0bcVpTR3uvfNvb80C4i5" > $HOME/.ssh/known_hosts
|
2021-12-03 18:34:49 +08:00
|
|
|
chmod 600 $HOME/.ssh/id_ed25519
|
2021-09-02 11:30:22 +08:00
|
|
|
LOCKCTL=$(mktemp -d)
|
|
|
|
mkfifo $LOCKCTL/lockctl
|
|
|
|
|
|
|
|
cat $LOCKCTL/lockctl | ${pkgs.openssh}/bin/ssh \
|
2021-12-03 18:34:49 +08:00
|
|
|
-i $HOME/.ssh/id_ed25519 \
|
2021-09-02 11:30:22 +08:00
|
|
|
-o UserKnownHostsFile=$HOME/.ssh/known_hosts \
|
|
|
|
rpi-1 \
|
|
|
|
'mkdir -p /tmp/board_lock && flock /tmp/board_lock/kc705-1 -c "echo Ok; cat"' \
|
|
|
|
| (
|
|
|
|
# End remote flock via FIFO
|
|
|
|
atexit_unlock() {
|
|
|
|
echo > $LOCKCTL/lockctl
|
|
|
|
}
|
|
|
|
trap atexit_unlock EXIT
|
|
|
|
|
|
|
|
# Read "Ok" line when remote successfully locked
|
|
|
|
read LOCK_OK
|
|
|
|
|
2022-02-14 15:54:17 +08:00
|
|
|
artiq_flash -t kc705 -H rpi-1 -d ${packages.x86_64-linux.artiq-board-kc705-nist_clock}
|
2021-09-02 11:30:22 +08:00
|
|
|
sleep 15
|
|
|
|
|
|
|
|
export ARTIQ_ROOT=`python -c "import artiq; print(artiq.__path__[0])"`/examples/kc705_nist_clock
|
|
|
|
export ARTIQ_LOW_LATENCY=1
|
|
|
|
python -m unittest discover -v artiq.test.coredevice
|
|
|
|
)
|
|
|
|
|
|
|
|
touch $out
|
|
|
|
'';
|
|
|
|
};
|
2022-02-11 14:36:18 +08:00
|
|
|
inherit (packages.x86_64-linux) artiq-manual-html artiq-manual-pdf;
|
2021-08-18 14:48:10 +08:00
|
|
|
};
|
2021-08-16 14:53:15 +08:00
|
|
|
};
|
2021-08-12 15:22:23 +08:00
|
|
|
|
|
|
|
nixConfig = {
|
2022-02-23 15:22:28 +08:00
|
|
|
extra-trusted-public-keys = "nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc=";
|
|
|
|
extra-substituters = "https://nixbld.m-labs.hk";
|
2022-02-23 15:30:16 +08:00
|
|
|
extra-sandbox-paths = "/opt";
|
2021-08-12 15:22:23 +08:00
|
|
|
};
|
2021-08-12 12:44:42 +08:00
|
|
|
}
|