Skip to content

WIP: Nix build

Phillip Seeber requested to merge nix into main

This PR adds the necessary definitions and files to enable a fully reproducible and system independent nix build of PyQD. The additions work as follows:

  • pyqd.nix defines a functions, which results in the nix derivation when called. This file basically defines how to build PyQD
  • nixpkgs.nix defines a pinned snapshot of nix packages from upstream. In addition a small overlay is being defined, which changes the NumPy and SciPy versions to the ones required by PyQD. Furthermore FFTW is overridden (in a little bit hacky way) to enable AVX2 support on x86_64 machines to improve performance of the numerical heavy FFTW routines.
  • default.nix is a magic nix entry point and calls the pyqd.nix function with the package set defined in nixpkgs.nix. The presence of this file allows you to simply say nix-build in the repository.
  • shell.nix is another magic nix entry point and defines and allows you to directly drop into a shell with PyQD available by saying nix-shell from this repo.

@FabianGD , could you please verify that everythings works as expected? As overriding of the performance critical packages breaks Nix caching be aware that all of FFTW, NumPy, SciPy and all their reverse dependencies (like Tensorflow, Numba, PyFFTW, matplotlib, ...) will be built from source, which will take some time.

In the NixWithChemistry overlay i would like to depend on the pyqd.nix added here with additional optimisations enabled in my overlay, such as MPI-enabled FFT, more hardware specific optimisations, CUDA support and so on.

Merge request reports