Show HN: Nixwrap – Run Nix packages from Python without Nix installed

https://github.com/elohmeier/nixwrap
by eloh • 7 months ago
2 0 7 months ago

I built a tool that lets you run any package from nixpkgs without having Nix installed on your system.

uvx nixwrap ripgrep --version uvx nixwrap jq --help uvx nixwrap bat README.md

How it works: 1. Queries nix-index-database to find packages 2. Fetches NARs from cache.nixos.org 3. Uses patchelf to fix binaries with hardcoded /nix/store paths 4. Runs via bundled ld-linux with the correct library path

There's also a PEP 503 package index, so you can install tools via pip/uv:

uvx --index-url https://elohmeier.github.io/nixwrap fd --version

Requires Python 3.14+ (uses stdlib compression.zstd for zero external dependencies). Linux only for now.

Works great for simple CLI tools. Complex packages with hardcoded runtime paths (like neovim) have limitations.

Related Stories

Loading related stories...

Source preview

github.com