nixwrap
Wrap Nix binaries into Python packages for installation via uv tool install.
Overview
nixwrap provides a way to distribute Nix-built binaries as Python packages. When a user installs a nixwrap package (e.g., ripgrep), the PEP 517 build backend:
- Fetches the narinfo and nar from the Nix binary cache
- Verifies the hash
- Extracts the binary
- Builds a wheel containing the binary as package data
Usage
# Install a tool from the nixwrap index
uv tool install --index-url https://elohmeier.github.io/nixwrap/ ripgrep
# Use the tool
rg --version
Repository Structure
nixwrap/
pyproject.toml # nixwrap-core (shared build backend)
src/nixwrap_core/
__init__.py
backend.py # PEP 517 build backend
runtime.py # Runtime binary executor
tools/
manifests/ # Tool manifest files
ripgrep.json
fd.json
build_index.py # Generates sdists + PEP 503 index
.github/workflows/
publish-pages.yml # CI for publishing to GitHub Pages
Adding a New Tool
- Create a manifest file in
tools/manifests/<tool>.json:
{
"name": "ripgrep",
"version": "15.1.0",
"dist": "ripgrep",
"command": "rg",
"description": "A line-oriented search tool",
"store_path": "/nix/store/...-ripgrep-15.1.0",
"bin_relpath": "bin/rg",
"cache_url": "https://cache.nixos.org",
"nar_hash": "sha256:...",
"ld_linux": "lib/ld-linux-x86-64.so.2",
"closure": [
{"store_path": "/nix/store/...-glibc-2.40-66", "nar_hash": "sha256:..."},
{"store_path": "/nix/store/...-pcre2-10.46", "nar_hash": "sha256:..."}
]
}
- Push to main - CI will regenerate the index and publish.
Development
# Install dependencies
uv sync
# Build the index locally
uv run python tools/build_index.py --manifests tools/manifests --out gh-pages
# Test a local install
uv tool install --index-url file://$(pwd)/gh-pages/ ripgrep
How It Works
Build Time (CI)
The build_index.py script:
- Reads each manifest from
tools/manifests/*.json - Creates ephemeral wrapper projects in a temp directory
- Builds sdists using
python -m build --sdist - Generates PEP 503 simple index HTML pages
- Publishes to GitHub Pages
Install Time (User)
When a user runs uv tool install ripgrep:
- uv downloads the sdist from the PEP 503 index
- The PEP 517 build backend (
nixwrap_core.backend) is invoked - The backend fetches the nar files from the Nix cache (main package + closure)
- The binary, dynamic linker, and libraries are extracted and embedded in the wheel
- The wheel is installed with the command available on PATH
- At runtime, the binary is invoked via the bundled dynamic linker
License
MIT
Metadata
Release files for nixwrap 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| nixwrap-0.11.0.tar.gz | 19.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nixwrap-0.11.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.6 kB
Release files / nixwrap-0.11.0.tar.gz
| Download URL | nixwrap-0.11.0.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98f4b73ba83198ffe8af5750c1e304938c16a7a48e60bdb035b3346e185c1cca
|
|
BLAKE2b-256 checksum How to use checksums |
10dd9289480750d1f6c888ee39690b11ea261292e9fae9eb0668911398e91467
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 3, 2026.
Transparency logRelease files / nixwrap-0.11.0-py3-none-any.whl
| Download URL | nixwrap-0.11.0-py3-none-any.whl |
|---|---|
| Size | 22.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50dd6e04dc35044d3c246dbb607db2e33499bb1ee02af354a5ae290db1caa0b9
|
|
BLAKE2b-256 checksum How to use checksums |
1001ed7da4ff2e64079b820178950f30c90c8d10c99e728ba06a5ea332e42c6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 3, 2026.
Transparency logSecurity for nixwrap 0.11.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for nixwrap-0.11.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.