Skip to main content

Nix-index database for nixwrap

Project description

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:

  1. Fetches the narinfo and nar from the Nix binary cache
  2. Verifies the hash
  3. Extracts the binary
  4. 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

  1. 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:..."}
  ]
}
  1. 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:

  1. Reads each manifest from tools/manifests/*.json
  2. Creates ephemeral wrapper projects in a temp directory
  3. Builds sdists using python -m build --sdist
  4. Generates PEP 503 simple index HTML pages
  5. Publishes to GitHub Pages

Install Time (User)

When a user runs uv tool install ripgrep:

  1. uv downloads the sdist from the PEP 503 index
  2. The PEP 517 build backend (nixwrap_core.backend) is invoked
  3. The backend fetches the nar files from the Nix cache (main package + closure)
  4. The binary, dynamic linker, and libraries are extracted and embedded in the wheel
  5. The wheel is installed with the command available on PATH
  6. At runtime, the binary is invoked via the bundled dynamic linker

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nixwrap_index-2026.1.3-py3-none-manylinux_2_17_x86_64.whl (89.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

nixwrap_index-2026.1.3-py3-none-manylinux_2_17_aarch64.whl (82.4 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

File details

Details for the file nixwrap_index-2026.1.3-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for nixwrap_index-2026.1.3-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d610f7bb8f853a64db9a50812596f54e053e7a82509f847fb98222e455bd03da
MD5 4600e57fb297b5d00714262c2715dbe8
BLAKE2b-256 51132c2152073656ea965366ff6aad6ab0cf9d4672f44a54dac68de645d3472a

See more details on using hashes here.

Provenance

The following attestation bundles were made for nixwrap_index-2026.1.3-py3-none-manylinux_2_17_x86_64.whl:

Publisher: publish-pypi-index.yml on elohmeier/nixwrap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nixwrap_index-2026.1.3-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for nixwrap_index-2026.1.3-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 5bc4328b36d9deb02908deecbfd0b965ccb2afadc30ae6097088d1a1cf4bf17e
MD5 bbd6e5b173155493f657b2f8e888bba3
BLAKE2b-256 f1c6584a8d42e0d26ebb64a84a8062734bcb5bf9c08a21098d359fbe6b86a04c

See more details on using hashes here.

Provenance

The following attestation bundles were made for nixwrap_index-2026.1.3-py3-none-manylinux_2_17_aarch64.whl:

Publisher: publish-pypi-index.yml on elohmeier/nixwrap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page