feat(nix): ❄️ add a flake with package, app and dev shell - #241
Draft
Panadestein wants to merge 5 commits into
Draft
feat(nix): ❄️ add a flake with package, app and dev shell#241Panadestein wants to merge 5 commits into
Panadestein wants to merge 5 commits into
Conversation
`nix build .#monoprop{,-mpi}` builds the bindings, `nix run` drops into a
Python interpreter with monoprop importable, and `nix develop` provides the
toolchain the DevContainer installs so `uv sync` and `just` work unchanged.
The packaged build turns off the C++ unit tests (they resolve msgpack-cxx
through a git fetch the sandbox denies) and `-march=native`, and pins the
version because setuptools-scm cannot read git metadata in the sandbox.
Assisted-by: GitHubCopilot:claude-opus-5
|
Docs preview: https://pr-241.monoprop-docs.pages.dev |
Signed-off-by: Ramón L. Panadés-Barrueta <rpana92@gmail.com>
Member
Author
Why not uv2nix?I evaluated uv2nix for this flake and decided against it.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Adds a Nix flake so Nix/NixOS users can build and hack on monoprop without installing the C++ toolchain, hwloc, Boost or MPI by hand.
Outputs
nix developuv,just, Node.js, clang-tools, gdb, lcov, doxygennix build .#monopropnix build .#monoprop-mpimonoprop_ENABLE_MPI=ONnix runmonopropimportableInside
nix develop, the existinguv syncandjustworkflows apply unchanged. The shell setsUV_PYTHON_PREFERENCE=only-system(uv's managed interpreters expect a loader NixOS does not provide, and[tool.uv]pinsonly-managed) andLD_LIBRARY_PATHso manylinux wheels resolvelibstdc++.Deviations from the
uvbuildAll three are in
nix/monoprop.nixand documented in the building guide:monoprop_ENABLE_ARCH_FLAGSis off, since a store path may be substituted onto a machine other than the one that built it..override { enableArchFlags = true; }restores-march=native.Notes for reviewers
[build-system] requiresasks for>=1.0.3, so the flake overrides it with the 1.0.3 PyPI sdist. That override should be dropped once nixpkgs catches up.mpi4pyis listed in[build-system] requiresunconditionally, so it is a build input even for the non-MPI package.tools/generate-dispatch.pyreads.github/license-header.txtduringcmake --install, but.githubis insdist.exclude. The flake works around it by including that one file in the source set; an sdist-based install would presumably hit the same failure.Validation
On
x86_64-linux:nix build .#monopropand.#monoprop-mpiboth compile and pass the import check,nix flake checkpasses,nix runevaluates aMajoranaOperator, anduv syncinsidenix developbuilds the bindings against the Nix toolchain. Darwin andaarch64-linuxare exposed viaflake-utils.lib.eachDefaultSystembut untested.