mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 11:18:27 +08:00
flake: format using alejandra
This commit is contained in:
parent
db293d5ecd
commit
9a8338d71b
139
flake.nix
139
flake.nix
@ -38,9 +38,20 @@
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, rust-overlay, sipyco, src-pythonparser, artiq-comtools, src-migen, src-misoc }:
|
||||
let
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import rust-overlay) ]; };
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
rust-overlay,
|
||||
sipyco,
|
||||
src-pythonparser,
|
||||
artiq-comtools,
|
||||
src-migen,
|
||||
src-misoc,
|
||||
}: let
|
||||
pkgs = import nixpkgs {
|
||||
system = "x86_64-linux";
|
||||
overlays = [(import rust-overlay)];
|
||||
};
|
||||
pkgs-aarch64 = import nixpkgs {system = "aarch64-linux";};
|
||||
|
||||
artiqVersionMajor = 9;
|
||||
@ -66,7 +77,8 @@
|
||||
cargo = rust;
|
||||
};
|
||||
|
||||
vivadoDeps = pkgs: with pkgs; let
|
||||
vivadoDeps = pkgs:
|
||||
with pkgs; let
|
||||
# Apply patch from https://github.com/nix-community/nix-environments/pull/54
|
||||
# to fix ncurses libtinfo.so's soname issue
|
||||
ncurses' = ncurses5.overrideAttrs (old: {
|
||||
@ -162,15 +174,15 @@
|
||||
version = artiqVersion;
|
||||
src = self;
|
||||
|
||||
preBuild =
|
||||
''
|
||||
preBuild = ''
|
||||
export VERSIONEER_OVERRIDE=${version}
|
||||
export VERSIONEER_REV=${artiqRev}
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [pkgs.qt6.wrapQtAppsHook];
|
||||
# keep llvm_x and lld_x in sync with llvmlite
|
||||
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 ]
|
||||
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]
|
||||
++ (with pkgs.python3Packages; [pyqtgraph pygit2 numpy dateutil scipy prettytable pyserial levenshtein h5py pyqt6 qasync tqdm lmdb jsonschema platformdirs]);
|
||||
|
||||
dontWrapQtApps = true;
|
||||
@ -180,8 +192,7 @@
|
||||
wrapQtApp "$out/bin/artiq_session"
|
||||
'';
|
||||
|
||||
preFixup =
|
||||
''
|
||||
preFixup = ''
|
||||
# Ensure that wrapProgram uses makeShellWrapper rather than makeBinaryWrapper
|
||||
# brought in by wrapQtAppsHook. Only makeShellWrapper supports --run.
|
||||
wrapProgram() { wrapProgramShell "$@"; }
|
||||
@ -206,9 +217,10 @@
|
||||
'';
|
||||
};
|
||||
|
||||
artiq = artiq-upstream // {
|
||||
withExperimentalFeatures = features: artiq-upstream.overrideAttrs(oa:
|
||||
{ patches = map (f: ./experimental-features/${f}.diff) features; });
|
||||
artiq =
|
||||
artiq-upstream
|
||||
// {
|
||||
withExperimentalFeatures = features: artiq-upstream.overrideAttrs (oa: {patches = map (f: ./experimental-features/${f}.diff) features;});
|
||||
};
|
||||
|
||||
migen = pkgs.python3Packages.buildPythonPackage rec {
|
||||
@ -261,7 +273,12 @@
|
||||
runScript = "vivado";
|
||||
};
|
||||
|
||||
makeArtiqBoardPackage = { target, variant, buildCommand ? "python -m artiq.gateware.targets.${target} -V ${variant}", experimentalFeatures ? [] }:
|
||||
makeArtiqBoardPackage = {
|
||||
target,
|
||||
variant,
|
||||
buildCommand ? "python -m artiq.gateware.targets.${target} -V ${variant}",
|
||||
experimentalFeatures ? [],
|
||||
}:
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "artiq-board-${target}-${variant}";
|
||||
phases = ["buildPhase" "checkPhase" "installPhase"];
|
||||
@ -281,8 +298,7 @@
|
||||
vivado
|
||||
rustPlatform.cargoSetupHook
|
||||
];
|
||||
buildPhase =
|
||||
''
|
||||
buildPhase = ''
|
||||
ARTIQ_PATH=`python -c "import artiq; print(artiq.__path__[0])"`
|
||||
ln -s $ARTIQ_PATH/firmware/Cargo.lock .
|
||||
cargoSetupPostUnpackHook
|
||||
@ -290,8 +306,7 @@
|
||||
${buildCommand}
|
||||
'';
|
||||
doCheck = true;
|
||||
checkPhase =
|
||||
''
|
||||
checkPhase = ''
|
||||
# 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
|
||||
@ -299,8 +314,7 @@
|
||||
check_log "\d+ constraint not met\."
|
||||
check_log "Timing constraints are not met\."
|
||||
'';
|
||||
installPhase =
|
||||
''
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
cp artiq_${target}/${variant}/gateware/top.bit $out
|
||||
if [ -e artiq_${target}/${variant}/software/bootloader/bootloader.bin ]
|
||||
@ -330,25 +344,45 @@
|
||||
sha256 = "1zqv47kzgvbn4c8cr019a6wcja7gn5h1z4kvw5bhpc72fyhagal9";
|
||||
};
|
||||
phases = ["installPhase"];
|
||||
installPhase =
|
||||
''
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/bscan-spi-bitstreams
|
||||
cp $src/*.bit $out/share/bscan-spi-bitstreams
|
||||
'';
|
||||
};
|
||||
in pkgs.buildEnv {
|
||||
in
|
||||
pkgs.buildEnv {
|
||||
name = "openocd-bscanspi";
|
||||
paths = [pkgs.openocd bscan_spi_bitstreams-pkg];
|
||||
};
|
||||
|
||||
latex-artiq-manual = pkgs.texlive.combine {
|
||||
inherit (pkgs.texlive)
|
||||
scheme-basic latexmk cmap collection-fontsrecommended fncychap
|
||||
titlesec tabulary varwidth framed fancyvrb float wrapfig parskip
|
||||
upquote capt-of needspace etoolbox booktabs pgf pgfplots;
|
||||
inherit
|
||||
(pkgs.texlive)
|
||||
scheme-basic
|
||||
latexmk
|
||||
cmap
|
||||
collection-fontsrecommended
|
||||
fncychap
|
||||
titlesec
|
||||
tabulary
|
||||
varwidth
|
||||
framed
|
||||
fancyvrb
|
||||
float
|
||||
wrapfig
|
||||
parskip
|
||||
upquote
|
||||
capt-of
|
||||
needspace
|
||||
etoolbox
|
||||
booktabs
|
||||
pgf
|
||||
pgfplots
|
||||
;
|
||||
};
|
||||
|
||||
artiq-frontend-dev-wrappers = pkgs.runCommandNoCC "artiq-frontend-dev-wrappers" {}
|
||||
artiq-frontend-dev-wrappers =
|
||||
pkgs.runCommandNoCC "artiq-frontend-dev-wrappers" {}
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
for program in ${self}/artiq/frontend/*.py; do
|
||||
@ -379,10 +413,17 @@
|
||||
name = "artiq-manual-html-${version}";
|
||||
version = artiqVersion;
|
||||
src = self;
|
||||
buildInputs = with pkgs.python3Packages; [
|
||||
sphinx sphinx_rtd_theme sphinxcontrib-tikz
|
||||
sphinx-argparse sphinxcontrib-wavedrom
|
||||
] ++ [ latex-artiq-manual artiq-comtools.packages.x86_64-linux.artiq-comtools
|
||||
buildInputs = with pkgs.python3Packages;
|
||||
[
|
||||
sphinx
|
||||
sphinx_rtd_theme
|
||||
sphinxcontrib-tikz
|
||||
sphinx-argparse
|
||||
sphinxcontrib-wavedrom
|
||||
]
|
||||
++ [
|
||||
latex-artiq-manual
|
||||
artiq-comtools.packages.x86_64-linux.artiq-comtools
|
||||
pkgs.pdf2svg
|
||||
];
|
||||
buildPhase = ''
|
||||
@ -401,10 +442,17 @@
|
||||
name = "artiq-manual-pdf-${version}";
|
||||
version = artiqVersion;
|
||||
src = self;
|
||||
buildInputs = with pkgs.python3Packages; [
|
||||
sphinx sphinx_rtd_theme sphinxcontrib-tikz
|
||||
sphinx-argparse sphinxcontrib-wavedrom
|
||||
] ++ [ latex-artiq-manual artiq-comtools.packages.x86_64-linux.artiq-comtools
|
||||
buildInputs = with pkgs.python3Packages;
|
||||
[
|
||||
sphinx
|
||||
sphinx_rtd_theme
|
||||
sphinxcontrib-tikz
|
||||
sphinx-argparse
|
||||
sphinxcontrib-wavedrom
|
||||
]
|
||||
++ [
|
||||
latex-artiq-manual
|
||||
artiq-comtools.packages.x86_64-linux.artiq-comtools
|
||||
pkgs.pdf2svg
|
||||
];
|
||||
buildPhase = ''
|
||||
@ -435,7 +483,8 @@
|
||||
# are added to PATH.
|
||||
default = pkgs.mkShell {
|
||||
name = "artiq-dev-shell";
|
||||
packages = with pkgs; [
|
||||
packages = with pkgs;
|
||||
[
|
||||
git
|
||||
lit
|
||||
lld_15
|
||||
@ -451,8 +500,8 @@
|
||||
python3Packages.sphinx_rtd_theme
|
||||
|
||||
(python3.withPackages (ps: [migen misoc microscope ps.packaging ps.paramiko] ++ artiq.propagatedBuildInputs))
|
||||
] ++
|
||||
[
|
||||
]
|
||||
++ [
|
||||
latex-artiq-manual
|
||||
rust
|
||||
artiq-frontend-dev-wrappers
|
||||
@ -502,8 +551,7 @@
|
||||
(pkgs.python3.withPackages (ps: with packages.x86_64-linux; [migen misoc artiq]))
|
||||
];
|
||||
phases = ["buildPhase"];
|
||||
buildPhase =
|
||||
''
|
||||
buildPhase = ''
|
||||
python -m unittest discover -v artiq.gateware.test
|
||||
touch $out
|
||||
'';
|
||||
@ -516,10 +564,14 @@
|
||||
#__impure = true; # Nix 2.8+
|
||||
|
||||
buildInputs = [
|
||||
(pkgs.python3.withPackages(ps: with packages.x86_64-linux; [
|
||||
(pkgs.python3.withPackages (
|
||||
ps:
|
||||
with packages.x86_64-linux;
|
||||
[
|
||||
artiq
|
||||
ps.paramiko
|
||||
] ++ ps.paramiko.optional-dependencies.ed25519
|
||||
]
|
||||
++ ps.paramiko.optional-dependencies.ed25519
|
||||
))
|
||||
pkgs.llvm_15
|
||||
pkgs.lld_15
|
||||
@ -527,8 +579,7 @@
|
||||
packages.x86_64-linux.openocd-bscanspi # for the bscanspi bitstreams
|
||||
];
|
||||
phases = ["buildPhase"];
|
||||
buildPhase =
|
||||
''
|
||||
buildPhase = ''
|
||||
export HOME=`mktemp -d`
|
||||
mkdir $HOME/.ssh
|
||||
cp /opt/hydra_id_ed25519 $HOME/.ssh/id_ed25519
|
||||
|
Loading…
Reference in New Issue
Block a user