On Ubuntu 22.04.5 LTS, I ran the following:

  1. sh <(curl -L https://nixos.org/nix/install) --no-daemon
  2. mkdir -p ~/.config/nix
  3. echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
  4. git clone https://github.com/m-labs/artiq.git ~/workspace/artiq
  5. cd ~/workspace/artiq && git checkout release-7
  6. nix develop
  7. I accepted all 6 prompts about the flake's config options and permanently marking them as trusted with y + Enter. (For what this means, check the Artiq manual: Installing via Nix (Linux): “Do you want to allow configuration setting… (y/N)?”.)
  8. git clone https://git.m-labs.hk/M-Labs/artiq-zynq.git ~/workspace/artiq-zynq
  9. cd ~/workspace/artiq-zynq && git checkout release-7
  10. nix develop

Everything went well until step no. 9. After I ran nix develop in step no. 10, my pc started by building a shit-load of packages from source and it took like 1-2 hours. This is what it looked like:

Questions:

  1. Doesn't M-Labs provide pre-compiled nix packages for artiq-zynq?
  2. If yes, why did nix not ask me about accepting the flake's config options in step no. 10? And why didn't it remember that I had already accepted them and permanently marked them as trusted in step no. 7?

    I thought it was done compiling stuff from source and it had started testing 34k modules with 8 workers, but then it started compiling again and I got annoyed and hit ctrl+C.

    Now I ran nix develop --accept-flake-config and it's building clang-11.1.0. To say this in German: Hä? Is this intended?

      I let it run for however long it wanted and it finally finished. All in all, it probably took 2 hours. (I didn't check the clock so much.)

      dtsevas

      This was an unfortunate side effect of llvmPackages_11 leaving the NixOS unstable channel. See this PR: https://git.m-labs.hk/M-Labs/zynq-rs/pulls/114.

      AFAIK your future builds should benefit from caching and thus be much faster.

      There is work being done at the moment to up the zynq-rs rustc version (and thus also the LLVM version), but there are quite a few subtle bugs to still iron out. When this is ready, the build time should come down significantly.

      If you find yourself recompiling clang over and over, you can clone zynq-rs and artiq-zynq locally and add another nix channel that contains llvmPackages_11 to the flake.nix in zynq-rs.

        dtsevas

        1. If yes, why did nix not ask me about accepting the flake's config options in step no. 10? And why didn't it remember that I had already accepted them and permanently marked them as trusted in step no. 7?

        It seems that trusted config settings are scoped locally per flake. Since artiq-zynq doesn't include the nixConfig options in its flake like artiq does, those settings aren’t applied automatically. To work around this, you’ll need to add the following lines manually to your .config/nix/nix.conf:

        extra-substituters = https://nixbld.m-labs.hk
        extra-trusted-public-keys = nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc=

          srenblad I can now run cd ~/workspace/artiq-zynq && nix develop without re-compiling anything, which is great. Is that what you meant? Or did you mean the actual build process nix build ...?

            dtsevas That's what he meant, yes. Nix caches dependencies, so until you run a garbage collect (nix-collect-garbage) to clear it or the flake changes, everything it needs to create the development environment should be somewhere in the Nix store.

            dtsevas Does that mean that M-Labs provides pre-compiled binaries for the packages specified by artiq-zynq/flake.nix (release-7)? You know this for sure?

            We're building artiq-zynq on Hydra, so yes all the dependencies for these builds should be available.