From 41caec797eb1afbbac6b99122d20b8c20536a786 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 30 May 2023 16:06:00 +0800 Subject: [PATCH] flake: do not install ARTIQ itself in dev shell, only its dependencies Otherwise, test runs take a long time when entering the shell, and failing tests stop entering the shell which is not what we want. Also make jsonschema a regular dependency of ARTIQ, since users can now retrieve JSONs via AFWS. --- doc/manual/developing.rst | 7 ++----- doc/manual/installing.rst | 1 - flake.nix | 6 +++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/doc/manual/developing.rst b/doc/manual/developing.rst index f2402e789..cea0c3e9b 100644 --- a/doc/manual/developing.rst +++ b/doc/manual/developing.rst @@ -14,12 +14,9 @@ ARTIQ itself does not depend on Nix, and it is also possible to compile everythi * Install the `Nix package manager `_, version 2.4 or later. Prefer a single-user installation for simplicity. * If you did not install Vivado in its default location ``/opt``, clone the ARTIQ Git repository and edit ``flake.nix`` accordingly. * Enable flakes in Nix by e.g. adding ``experimental-features = nix-command flakes`` to ``nix.conf`` (for example ``~/.config/nix/nix.conf``). -* Enter the development shell by running ``nix develop git+https://github.com/m-labs/artiq.git``, or alternatively by cloning the ARTIQ Git repository and running ``nix develop`` at the root (where ``flake.nix`` is). +* Clone the ARTIQ Git repository and run ``nix develop`` at the root (where ``flake.nix`` is). +* Make the current source code of ARTIQ available to the Python interpreter by running ``export PYTHONPATH=`pwd`:$PYTHONPATH``. * You can then build the firmware and gateware with a command such as ``$ python -m artiq.gateware.targets.kasli``. If you are using a JSON system description file, use ``$ python -m artiq.gateware.targets.kasli_generic file.json``. * Flash the binaries into the FPGA board with a command such as ``$ artiq_flash --srcbuild -d artiq_kasli/``. You need to configure OpenOCD as explained :ref:`in the user section `. OpenOCD is already part of the flake's development environment. * Check that the board boots and examine the UART messages by running a serial terminal program, e.g. ``$ flterm /dev/ttyUSB1`` (``flterm`` is part of MiSoC and installed in the flake's development environment). Leave the terminal running while you are flashing the board, so that you see the startup messages when the board boots immediately after flashing. You can also restart the board (without reflashing it) with ``$ artiq_flash start``. * The communication parameters are 115200 8-N-1. Ensure that your user has access to the serial device (e.g. by adding the user account to the ``dialout`` group). - - -.. warning:: - Nix will make a read-only copy of the ARTIQ source to use in the shell environment. Therefore, any modifications that you make to the source after the shell is started will not be taken into account. A solution applicable to ARTIQ (and several other Python packages such as Migen and MiSoC) is to prepend the ARTIQ source directory to the ``PYTHONPATH`` environment variable after entering the shell. If you want this to be done by default, edit the ``devShell`` section of ``flake.nix``. diff --git a/doc/manual/installing.rst b/doc/manual/installing.rst index 75aa31efb..916cfec8c 100644 --- a/doc/manual/installing.rst +++ b/doc/manual/installing.rst @@ -51,7 +51,6 @@ Installing multiple packages and making them visible to the ARTIQ commands requi #ps.scipy #ps.numba #ps.matplotlib - #ps.jsonschema # required by artiq_ddb_template # or if you need Qt (will recompile): #(ps.matplotlib.override { enableQt = true; }) #ps.bokeh diff --git a/flake.nix b/flake.nix index 9d92902f4..1dc522ae5 100644 --- a/flake.nix +++ b/flake.nix @@ -125,7 +125,7 @@ nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ]; # keep llvm_x and lld_x in sync with llvmlite propagatedBuildInputs = [ pkgs.llvm_11 pkgs.lld_11 sipyco.packages.x86_64-linux.sipyco pythonparser artiq-comtools.packages.x86_64-linux.artiq-comtools ] - ++ (with pkgs.python3Packages; [ llvmlite pyqtgraph pygit2 numpy dateutil scipy prettytable pyserial levenshtein h5py pyqt5 qasync tqdm lmdb ]); + ++ (with pkgs.python3Packages; [ llvmlite pyqtgraph pygit2 numpy dateutil scipy prettytable pyserial levenshtein h5py pyqt5 qasync tqdm lmdb jsonschema ]); dontWrapQtApps = true; postFixup = '' @@ -224,7 +224,7 @@ }; }; nativeBuildInputs = [ - (pkgs.python3.withPackages(ps: [ ps.jsonschema migen misoc (artiq.withExperimentalFeatures experimentalFeatures) ])) + (pkgs.python3.withPackages(ps: [ migen misoc (artiq.withExperimentalFeatures experimentalFeatures) ])) rust pkgs.cargo-xbuild pkgs.llvmPackages_11.clang-unwrapped @@ -384,7 +384,7 @@ devShell.x86_64-linux = pkgs.mkShell { name = "artiq-dev-shell"; buildInputs = [ - (pkgs.python3.withPackages(ps: with packages.x86_64-linux; [ migen misoc artiq ps.paramiko ps.jsonschema microscope ])) + (pkgs.python3.withPackages(ps: with packages.x86_64-linux; [ migen misoc ps.paramiko microscope ] ++ artiq.propagatedBuildInputs )) rust pkgs.cargo-xbuild pkgs.llvmPackages_11.clang-unwrapped