2021-08-12 12:44:42 +08:00
|
|
|
{
|
|
|
|
description = "A leading-edge control system for quantum information experiments";
|
|
|
|
|
2024-11-08 01:20:07 +08:00
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
|
|
|
|
rust-overlay = {
|
2024-08-14 16:52:46 +08:00
|
|
|
url = "github:oxalica/rust-overlay?ref=snapshot/2024-08-01";
|
2024-06-20 16:07:45 +08:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2024-11-08 01:20:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
artiq-comtools = {
|
|
|
|
url = "github:m-labs/artiq-comtools";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.sipyco.follows = "sipyco";
|
|
|
|
};
|
|
|
|
|
|
|
|
sipyco = {
|
|
|
|
url = "github:m-labs/sipyco";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
|
|
|
|
src-migen = {
|
|
|
|
url = "github:m-labs/migen";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
src-misoc = {
|
|
|
|
url = "https://github.com/m-labs/misoc.git";
|
|
|
|
type = "git";
|
|
|
|
submodules = true;
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
src-pythonparser = {
|
|
|
|
url = "github:m-labs/pythonparser";
|
|
|
|
flake = false;
|
|
|
|
};
|
2024-06-20 16:07:45 +08:00
|
|
|
};
|
2021-08-16 16:38:55 +08:00
|
|
|
|
2024-06-20 16:07:45 +08:00
|
|
|
outputs = { self, nixpkgs, rust-overlay, sipyco, src-pythonparser, artiq-comtools, src-migen, src-misoc }:
|
2021-08-16 14:53:15 +08:00
|
|
|
let
|
2024-06-20 16:07:45 +08:00
|
|
|
pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import rust-overlay) ]; };
|
2022-07-08 11:35:17 +08:00
|
|
|
pkgs-aarch64 = import nixpkgs { system = "aarch64-linux"; };
|
2022-01-19 19:58:55 +08:00
|
|
|
|
2024-06-06 09:45:54 +08:00
|
|
|
artiqVersionMajor = 9;
|
2022-01-19 19:58:55 +08:00
|
|
|
artiqVersionMinor = self.sourceInfo.revCount or 0;
|
|
|
|
artiqVersionId = self.sourceInfo.shortRev or "unknown";
|
2023-04-30 16:55:49 +08:00
|
|
|
artiqVersion = (builtins.toString artiqVersionMajor) + "." + (builtins.toString artiqVersionMinor) + "+" + artiqVersionId + ".beta";
|
2022-02-08 21:05:39 +08:00
|
|
|
artiqRev = self.sourceInfo.rev or "unknown";
|
2022-01-19 19:58:55 +08:00
|
|
|
|
2024-12-11 23:11:59 +08:00
|
|
|
qtPaths = let
|
|
|
|
inherit (pkgs.qt6) qtbase qtsvg;
|
|
|
|
inherit (qtbase.dev) qtPluginPrefix qtQmlPrefix;
|
|
|
|
in {
|
|
|
|
QT_PLUGIN_PATH = "${qtbase}/${qtPluginPrefix}:${qtsvg}/${qtPluginPrefix}";
|
|
|
|
QML2_IMPORT_PATH = "${qtbase}/${qtQmlPrefix}";
|
2024-11-25 11:38:58 +08:00
|
|
|
};
|
|
|
|
|
2024-06-20 18:49:17 +08:00
|
|
|
rust = pkgs.rust-bin.nightly."2021-09-01".default.override {
|
2024-06-20 16:07:45 +08:00
|
|
|
extensions = [ "rust-src" ];
|
|
|
|
targets = [ ];
|
2021-08-12 12:44:42 +08:00
|
|
|
};
|
2024-06-20 16:07:45 +08:00
|
|
|
rustPlatform = pkgs.makeRustPlatform {
|
2021-08-16 14:53:15 +08:00
|
|
|
rustc = rust;
|
|
|
|
cargo = rust;
|
2024-06-20 16:07:45 +08:00
|
|
|
};
|
2021-09-10 17:19:32 +08:00
|
|
|
|
2023-11-28 16:54:13 +08:00
|
|
|
vivadoDeps = pkgs: with pkgs; let
|
2023-09-14 10:57:37 +08:00
|
|
|
# Apply patch from https://github.com/nix-community/nix-environments/pull/54
|
|
|
|
# to fix ncurses libtinfo.so's soname issue
|
2023-11-28 16:54:13 +08:00
|
|
|
ncurses' = ncurses5.overrideAttrs (old: {
|
|
|
|
configureFlags = old.configureFlags ++ [ "--with-termlib" ];
|
|
|
|
postFixup = "";
|
|
|
|
});
|
2023-09-14 10:57:37 +08:00
|
|
|
in [
|
2023-05-27 17:16:31 +08:00
|
|
|
libxcrypt-legacy
|
2023-11-28 16:54:13 +08:00
|
|
|
(ncurses'.override { unicodeSupport = false; })
|
2021-08-25 13:22:44 +08:00
|
|
|
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";
|
2024-09-30 14:58:02 +08:00
|
|
|
version = "0.27.1";
|
|
|
|
format = "pyproject";
|
2021-09-10 17:19:32 +08:00
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "CabbageDevelopment";
|
|
|
|
repo = "qasync";
|
2024-09-30 14:58:02 +08:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
sha256 = "sha256-oXzwilhJ1PhodQpOZjnV9gFuoDy/zXWva9LhhK3T00g=";
|
2021-08-12 12:44:42 +08:00
|
|
|
};
|
2024-09-30 14:58:02 +08:00
|
|
|
postPatch = ''
|
|
|
|
rm qasync/_windows.py # Ignoring it is not taking effect and it will not be used on Linux
|
|
|
|
'';
|
|
|
|
buildInputs = [ pkgs.python3Packages.poetry-core ];
|
2023-09-17 06:52:13 +08:00
|
|
|
propagatedBuildInputs = [ pkgs.python3Packages.pyqt6 ];
|
2024-09-30 14:58:02 +08:00
|
|
|
checkInputs = [ pkgs.python3Packages.pytestCheckHook ];
|
|
|
|
pythonImportsCheck = [ "qasync" ];
|
2023-05-27 17:16:31 +08:00
|
|
|
disabledTestPaths = [ "tests/test_qeventloop.py" ];
|
2021-09-10 17:19:32 +08:00
|
|
|
};
|
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;
|
2023-05-27 17:40:36 +08:00
|
|
|
buildInputs = [ rust ];
|
2021-09-10 17:19:32 +08:00
|
|
|
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
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-08-07 23:02:23 +08:00
|
|
|
llvmlite-new = pkgs.python3Packages.buildPythonPackage rec {
|
|
|
|
pname = "llvmlite";
|
2024-07-10 16:43:37 +08:00
|
|
|
version = "0.43.0";
|
2023-08-07 23:02:23 +08:00
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "numba";
|
|
|
|
repo = "llvmlite";
|
|
|
|
rev = "v${version}";
|
2024-07-10 16:43:37 +08:00
|
|
|
sha256 = "sha256-5QBSRDb28Bui9IOhGofj+c7Rk7J5fNv5nPksEPY/O5o=";
|
2023-08-07 23:02:23 +08:00
|
|
|
};
|
2024-07-10 16:43:37 +08:00
|
|
|
nativeBuildInputs = [ pkgs.llvm_15 ];
|
2023-08-07 23:02:23 +08:00
|
|
|
# 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 = ''
|
2024-07-10 16:43:37 +08:00
|
|
|
export LLVM_CONFIG=${pkgs.llvm_15.dev}/bin/llvm-config
|
2023-08-07 23:02:23 +08:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-09-05 11:48:43 +08:00
|
|
|
artiq-upstream = pkgs.python3Packages.buildPythonPackage rec {
|
2021-09-10 17:19:32 +08:00
|
|
|
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
|
|
|
|
2023-09-17 06:52:13 +08:00
|
|
|
nativeBuildInputs = [ pkgs.qt6.wrapQtAppsHook ];
|
2021-09-10 17:19:32 +08:00
|
|
|
# keep llvm_x and lld_x in sync with llvmlite
|
2023-09-17 06:52:13 +08:00
|
|
|
propagatedBuildInputs = [ pkgs.llvm_15 pkgs.lld_15 sipyco.packages.x86_64-linux.sipyco pythonparser llvmlite-new pkgs.qt6.qtsvg artiq-comtools.packages.x86_64-linux.artiq-comtools ]
|
2024-08-27 13:59:05 +08:00
|
|
|
++ (with pkgs.python3Packages; [ pyqtgraph pygit2 numpy dateutil scipy prettytable pyserial levenshtein h5py pyqt6 qasync tqdm lmdb jsonschema platformdirs ]);
|
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
|
|
|
|
2023-05-27 17:16:31 +08:00
|
|
|
preFixup =
|
|
|
|
''
|
|
|
|
# Ensure that wrapProgram uses makeShellWrapper rather than makeBinaryWrapper
|
|
|
|
# brought in by wrapQtAppsHook. Only makeShellWrapper supports --run.
|
|
|
|
wrapProgram() { wrapProgramShell "$@"; }
|
|
|
|
'';
|
|
|
|
## 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
|
2021-09-10 17:19:32 +08:00
|
|
|
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
|
|
|
|
2024-07-10 16:43:37 +08:00
|
|
|
# FIXME: automatically propagate lld_15 llvm_15 dependencies
|
2023-04-24 11:43:24 +08:00
|
|
|
# cacert is required in the check stage only, as certificates are to be
|
|
|
|
# obtained from system elsewhere
|
2024-07-10 16:43:37 +08:00
|
|
|
nativeCheckInputs = with pkgs; [ lld_15 llvm_15 lit outputcheck cacert ] ++ [ libartiq-support ];
|
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
|
|
|
|
2022-09-05 11:48:43 +08:00
|
|
|
artiq = artiq-upstream // {
|
|
|
|
withExperimentalFeatures = features: artiq-upstream.overrideAttrs(oa:
|
|
|
|
{ patches = map (f: ./experimental-features/${f}.diff) features; });
|
|
|
|
};
|
|
|
|
|
2021-09-10 17:19:32 +08:00
|
|
|
migen = pkgs.python3Packages.buildPythonPackage rec {
|
|
|
|
name = "migen";
|
|
|
|
src = src-migen;
|
2023-09-06 18:28:08 +08:00
|
|
|
format = "pyproject";
|
|
|
|
nativeBuildInputs = [ pkgs.python3Packages.setuptools ];
|
2021-09-10 17:19:32 +08:00
|
|
|
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";
|
2024-10-08 15:11:34 +08:00
|
|
|
version = "1.0";
|
2021-09-10 17:19:32 +08:00
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "m-labs";
|
|
|
|
repo = "asyncserial";
|
2024-10-08 15:11:34 +08:00
|
|
|
rev = version;
|
|
|
|
sha256 = "sha256-ZHzgJnbsDVxVcp09LXq9JZp46+dorgdP8bAiTB59K28=";
|
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;
|
|
|
|
propagatedBuildInputs = with pkgs.python3Packages; [ jinja2 numpy migen pyserial asyncserial ];
|
|
|
|
};
|
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
|
2023-05-27 18:03:18 +08:00
|
|
|
vivadoEnv = pkgs.buildFHSEnv {
|
2021-09-10 17:19:32 +08:00
|
|
|
name = "vivado-env";
|
|
|
|
targetPkgs = vivadoDeps;
|
|
|
|
};
|
|
|
|
|
2023-05-27 18:03:18 +08:00
|
|
|
vivado = pkgs.buildFHSEnv {
|
2021-09-10 17:19:32 +08:00
|
|
|
name = "vivado";
|
|
|
|
targetPkgs = vivadoDeps;
|
2022-12-18 16:51:02 +08:00
|
|
|
profile = "set -e; source /opt/Xilinx/Vivado/2022.2/settings64.sh";
|
2021-09-10 17:19:32 +08:00
|
|
|
runScript = "vivado";
|
|
|
|
};
|
|
|
|
|
2022-09-05 11:48:43 +08:00
|
|
|
makeArtiqBoardPackage = { target, variant, buildCommand ? "python -m artiq.gateware.targets.${target} -V ${variant}", experimentalFeatures ? [] }:
|
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 = {
|
2024-05-29 11:01:43 +08:00
|
|
|
"fringe-1.2.1" = "sha256-u7NyZBzGrMii79V+Xs4Dx9tCpiby6p8IumkUl7oGBm0=";
|
2023-10-30 17:15:19 +08:00
|
|
|
"tar-no-std-0.1.8" = "sha256-xm17108v4smXOqxdLvHl9CxTCJslmeogjm4Y87IXFuM=";
|
2022-04-24 14:02:59 +08:00
|
|
|
};
|
2021-09-01 17:45:27 +08:00
|
|
|
};
|
2021-09-10 17:19:32 +08:00
|
|
|
nativeBuildInputs = [
|
2023-06-05 13:17:47 +08:00
|
|
|
(pkgs.python3.withPackages(ps: [ migen misoc (artiq.withExperimentalFeatures experimentalFeatures) ps.packaging ]))
|
2023-05-27 17:40:36 +08:00
|
|
|
rust
|
2024-07-10 16:43:37 +08:00
|
|
|
pkgs.llvmPackages_15.clang-unwrapped
|
|
|
|
pkgs.llvm_15
|
|
|
|
pkgs.lld_15
|
2021-09-10 17:19:32 +08:00
|
|
|
vivado
|
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
];
|
2024-06-20 16:07:45 +08:00
|
|
|
buildPhase =
|
2021-09-10 17:19:32 +08:00
|
|
|
''
|
|
|
|
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 =
|
|
|
|
''
|
2023-08-25 13:25:22 +08:00
|
|
|
mkdir $out
|
|
|
|
cp artiq_${target}/${variant}/gateware/top.bit $out
|
2021-09-10 17:19:32 +08:00
|
|
|
if [ -e artiq_${target}/${variant}/software/bootloader/bootloader.bin ]
|
2023-08-25 13:25:22 +08:00
|
|
|
then cp artiq_${target}/${variant}/software/bootloader/bootloader.bin $out
|
2021-09-10 17:19:32 +08:00
|
|
|
fi
|
|
|
|
if [ -e artiq_${target}/${variant}/software/runtime ]
|
2023-08-25 13:25:22 +08:00
|
|
|
then cp artiq_${target}/${variant}/software/runtime/runtime.{elf,fbi} $out
|
|
|
|
else cp artiq_${target}/${variant}/software/satman/satman.{elf,fbi} $out
|
2021-09-10 17:19:32 +08:00
|
|
|
fi
|
2023-08-25 13:25:22 +08:00
|
|
|
|
|
|
|
mkdir $out/nix-support
|
|
|
|
for i in $out/*.*; do
|
|
|
|
echo file binary-dist $i >> $out/nix-support/hydra-build-products
|
|
|
|
done
|
2021-09-10 17:19:32 +08:00
|
|
|
'';
|
|
|
|
# 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
|
|
|
in pkgs.buildEnv {
|
|
|
|
name = "openocd-bscanspi";
|
2024-06-20 21:51:50 +08:00
|
|
|
paths = [ pkgs.openocd bscan_spi_bitstreams-pkg ];
|
2021-09-10 17:19:32 +08:00
|
|
|
};
|
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
|
2024-08-05 15:51:40 +08:00
|
|
|
upquote capt-of needspace etoolbox booktabs pgf pgfplots;
|
2022-02-09 10:53:52 +08:00
|
|
|
};
|
2023-12-17 13:41:49 +08:00
|
|
|
|
|
|
|
artiq-frontend-dev-wrappers = pkgs.runCommandNoCC "artiq-frontend-dev-wrappers" {}
|
|
|
|
''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
for program in ${self}/artiq/frontend/*.py; do
|
|
|
|
if [ -x $program ]; then
|
|
|
|
progname=`basename -s .py $program`
|
|
|
|
outname=$out/bin/$progname
|
|
|
|
echo "#!${pkgs.bash}/bin/bash" >> $outname
|
2023-12-17 19:42:56 +08:00
|
|
|
echo "exec python3 -m artiq.frontend.$progname \"\$@\"" >> $outname
|
2023-12-17 13:41:49 +08:00
|
|
|
chmod 755 $outname
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
2021-09-10 17:19:32 +08:00
|
|
|
in rec {
|
2022-02-11 14:36:18 +08:00
|
|
|
packages.x86_64-linux = {
|
2023-06-14 18:54:33 +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
|
|
|
};
|
2023-08-25 15:52:40 +08:00
|
|
|
artiq-board-efc-shuttler = makeArtiqBoardPackage {
|
2023-08-25 13:34:56 +08:00
|
|
|
target = "efc";
|
|
|
|
variant = "shuttler";
|
|
|
|
};
|
2024-03-27 17:49:25 +08:00
|
|
|
inherit latex-artiq-manual;
|
2022-02-11 14:36:18 +08:00
|
|
|
artiq-manual-html = pkgs.stdenvNoCC.mkDerivation rec {
|
|
|
|
name = "artiq-manual-html-${version}";
|
|
|
|
version = artiqVersion;
|
|
|
|
src = self;
|
2024-03-27 17:49:25 +08:00
|
|
|
buildInputs = with pkgs.python3Packages; [
|
2024-08-05 15:51:40 +08:00
|
|
|
sphinx sphinx_rtd_theme sphinxcontrib-tikz
|
2024-03-27 17:49:25 +08:00
|
|
|
sphinx-argparse sphinxcontrib-wavedrom
|
2024-08-05 15:51:40 +08:00
|
|
|
] ++ [ latex-artiq-manual artiq-comtools.packages.x86_64-linux.artiq-comtools
|
|
|
|
pkgs.pdf2svg
|
|
|
|
];
|
2022-02-11 14:36:18 +08:00
|
|
|
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;
|
2024-03-27 17:49:25 +08:00
|
|
|
buildInputs = with pkgs.python3Packages; [
|
2024-08-05 15:51:40 +08:00
|
|
|
sphinx sphinx_rtd_theme sphinxcontrib-tikz
|
2024-03-27 17:49:25 +08:00
|
|
|
sphinx-argparse sphinxcontrib-wavedrom
|
2024-08-05 15:51:40 +08:00
|
|
|
] ++ [ latex-artiq-manual artiq-comtools.packages.x86_64-linux.artiq-comtools
|
|
|
|
pkgs.pdf2svg
|
|
|
|
];
|
2022-02-11 14:36:18 +08:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2024-11-25 11:38:58 +08:00
|
|
|
inherit qtPaths makeArtiqBoardPackage openocd-bscanspi-f;
|
2022-01-30 19:31:20 +08:00
|
|
|
|
2024-12-01 08:26:44 +08:00
|
|
|
packages.x86_64-linux.default = pkgs.python3.withPackages(_: [ packages.x86_64-linux.artiq ]);
|
2021-08-16 16:38:55 +08:00
|
|
|
|
2024-12-01 07:58:34 +08:00
|
|
|
devShells.x86_64-linux = {
|
|
|
|
# Main development shell with everything you need to develop ARTIQ on Linux.
|
|
|
|
# The current copy of the ARTIQ sources is added to PYTHONPATH so changes can be tested instantly.
|
|
|
|
# Additionally, executable wrappers that import the current ARTIQ sources for the ARTIQ frontends
|
|
|
|
# are added to PATH.
|
|
|
|
default = pkgs.mkShell {
|
|
|
|
name = "artiq-dev-shell";
|
|
|
|
packages = with pkgs; [
|
|
|
|
git
|
|
|
|
lit
|
|
|
|
lld_15
|
|
|
|
llvm_15
|
|
|
|
llvmPackages_15.clang-unwrapped
|
|
|
|
outputcheck
|
|
|
|
pdf2svg
|
|
|
|
|
|
|
|
python3Packages.sphinx
|
|
|
|
python3Packages.sphinx-argparse
|
|
|
|
python3Packages.sphinxcontrib-tikz
|
|
|
|
python3Packages.sphinxcontrib-wavedrom
|
|
|
|
python3Packages.sphinx_rtd_theme
|
|
|
|
|
|
|
|
(python3.withPackages(ps: [ migen misoc microscope ps.packaging ps.paramiko ] ++ artiq.propagatedBuildInputs ))
|
|
|
|
] ++
|
|
|
|
[
|
|
|
|
latex-artiq-manual
|
|
|
|
rust
|
|
|
|
artiq-frontend-dev-wrappers
|
2021-08-18 14:48:10 +08:00
|
|
|
|
2024-12-01 07:58:34 +08:00
|
|
|
# To manually run compiler tests:
|
|
|
|
libartiq-support
|
|
|
|
|
|
|
|
# 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
|
|
|
|
packages.x86_64-linux.openocd-bscanspi
|
|
|
|
];
|
|
|
|
shellHook = ''
|
|
|
|
export LIBARTIQ_SUPPORT=`libartiq-support`
|
|
|
|
export QT_PLUGIN_PATH=${qtPaths.QT_PLUGIN_PATH}
|
|
|
|
export QML2_IMPORT_PATH=${qtPaths.QML2_IMPORT_PATH}
|
|
|
|
export PYTHONPATH=`git rev-parse --show-toplevel`:$PYTHONPATH
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
# Lighter development shell optimized for building firmware and flashing boards.
|
|
|
|
boards = pkgs.mkShell {
|
|
|
|
name = "artiq-boards-shell";
|
|
|
|
packages = [
|
|
|
|
rust
|
|
|
|
|
|
|
|
pkgs.llvmPackages_15.clang-unwrapped
|
|
|
|
pkgs.llvm_15
|
|
|
|
pkgs.lld_15
|
|
|
|
|
|
|
|
packages.x86_64-linux.vivado
|
|
|
|
packages.x86_64-linux.openocd-bscanspi
|
|
|
|
|
|
|
|
(pkgs.python3.withPackages(ps: [ migen misoc artiq ps.packaging ps.paramiko ]))
|
|
|
|
];
|
|
|
|
};
|
2023-05-30 16:21:06 +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 = {
|
2023-08-25 15:52:40 +08:00
|
|
|
inherit (packages.x86_64-linux) artiq artiq-board-kc705-nist_clock artiq-board-efc-shuttler openocd-bscanspi;
|
2023-01-09 18:36:55 +08:00
|
|
|
gateware-sim = pkgs.stdenvNoCC.mkDerivation {
|
|
|
|
name = "gateware-sim";
|
|
|
|
buildInputs = [
|
|
|
|
(pkgs.python3.withPackages(ps: with packages.x86_64-linux; [ migen misoc artiq ]))
|
|
|
|
];
|
|
|
|
phases = [ "buildPhase" ];
|
|
|
|
buildPhase =
|
|
|
|
''
|
|
|
|
python -m unittest discover -v artiq.gateware.test
|
|
|
|
touch $out
|
|
|
|
'';
|
|
|
|
};
|
2023-01-09 18:22:05 +08:00
|
|
|
kc705-hitl = pkgs.stdenvNoCC.mkDerivation {
|
2021-09-02 11:30:22 +08:00
|
|
|
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 = [
|
2024-10-31 10:03:12 +08:00
|
|
|
(pkgs.python3.withPackages(ps: with packages.x86_64-linux; [
|
|
|
|
artiq
|
|
|
|
ps.paramiko
|
|
|
|
] ++ ps.paramiko.optional-dependencies.ed25519
|
|
|
|
))
|
2024-07-10 16:43:37 +08:00
|
|
|
pkgs.llvm_15
|
|
|
|
pkgs.lld_15
|
2021-09-02 11:30:22 +08:00
|
|
|
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 =
|
|
|
|
''
|
|
|
|
export HOME=`mktemp -d`
|
|
|
|
mkdir $HOME/.ssh
|
2024-08-01 07:35:20 +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
|
2024-08-01 07:35:20 +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}
|
2023-06-02 17:41:15 +08:00
|
|
|
sleep 30
|
2021-09-02 11:30:22 +08:00
|
|
|
|
|
|
|
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
|
|
|
}
|