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