Skip to content

Experimental: Nix packaging - #1935

Open
franzpoeschel wants to merge 17 commits into
openPMD:devfrom
franzpoeschel:nix
Open

Experimental: Nix packaging#1935
franzpoeschel wants to merge 17 commits into
openPMD:devfrom
franzpoeschel:nix

Conversation

@franzpoeschel

@franzpoeschel franzpoeschel commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Pros:

  • one further deployment target
  • developers can enter a reproducible development shell with all necessary dependencies using nix develop
  • reproducible software environment for CI runs
  • openPMD tooling available on-the-fly without installation via nix run <flake-location>#ls (or pipe)
  • HDF5 and ADIOS2 are also deployed there

Todo:

  • Add an integration test for those tests that are too complex for the Nix build sandbox

franzpoeschel and others added 17 commits September 4, 2026 11:13
MPI test failing still
Move the overlay definition to nix/overlay.nix and split the
pybind11 and python3 overrides into dedicated files under nix/,
matching the existing per-package layout (nix/adios2, nix/openpmd_api).
openpmd_api/default.nix declares mpi ? null and filters empty entries
out of propagatedBuildInputs, but mpi.dev was dereferenced before the
filter, crashing when mpi is null. Only propagate mpi.dev when mpi is
present.
Drop the hand-maintained ADIOS2 fork and the pybind11/python3 override
machinery in favor of the nixpkgs-provided packages, which already
satisfy the version requirements. Clean up the openpmd_api package:

- propagate mpi only once instead of both mpi and mpi.dev
- use lib.cmakeBool and lowercase pname
- set proper meta (homepage, description, changelog, license,
  maintainers) and build for all of platforms.unix instead of x86
  only, fixing builds on aarch64
- derive the package version from the CMake project version instead of
  hardcoding it
- expose the openpmd-ls and openpmd-pipe command line tools as apps
- add a development shell with the project toolchain and linters
- make 'nix fmt' work by providing a formatter (nixfmt-tree)
- drop leftover nixosModules scaffolding from the flake template
Move the apps and devShells definitions into their own files
(nix/apps.nix, nix/devShells.nix). Derive the package version from the
OPENPMDAPI_VERSION_* macros in include/openPMD/version.hpp, appending the
version label (e.g. 'dev') only when it is non-empty instead of always
suffixing '-dev'.
Add an openpmd-example-datasets derivation that mirrors
share/openPMD/download_samples.sh but fetches the pinned example
datasets as fixed-output derivations, and feed it into the check so the
data-dependent tests run.

Fix checks.x86_64-linux.test, which previously always failed by design
(postBuild ran 'ctest ... false' and no sample data was available):
- run the suite via doInstallCheck with CTest in serial mode (-j 1),
  since CMake 4 defaults to parallel execution which exhausts the
  sandbox process limit (cgroup pids.max) and makes MPI/PmiX thread
  creation fail intermittently
- copy the sample data into the CMake build directory (nixpkgs
  configures out-of-source into cmakeBuildDir) so the example, tool and
  Python-unittest tests are registered
- skip the MPI-based tests in the sandbox: the C++ parallel append-mode
  tests read back iterations in an order that depends on MPI write
  scheduling (hard-coded iterationOrder assertion), and other tests
  launch mpiexec / import the MPI-enabled Python binding (CLI.pipe.py,
  Example.py.*_parallel), which is order-, timing- and resource-
  sensitive on a single node

Also ignore the /result symlinks created by 'nix build'.
Silences the 'app lacks attribute meta' warnings from 'nix flake check'.
Add a GitHub Actions workflow that installs Nix with the Determinate
Systems installer, caches the Nix store, and runs 'nix flake check'.
Do not let the generic cmake checkPhase drive ctest when building through
plain stdenv.mkDerivation (i.e. python = null): buildPythonPackage has no
checkPhase and remaps doCheck to installCheckPhase itself, but the stdenv
path used to run ctest both in checkPhase and installCheckPhase when
doCheck = true.

Keep the caller's check intent under a separate binding and route all
testing through the (restricted) installCheckPhase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant