Nix and other store-based package managers hardcode absolute store paths into binaries, making them non-relocatable. Changing the store prefix invalidates hashes, forcing full recompilation and preventing use of public binary caches. The author proposes using relative paths via the Linux dynamic linker's $ORIGIN variable in RUNPATH, but two kernel-level blockers remain: PT_INTERP (the program interpreter path) and shebang lines do not support $ORIGIN. Proposed solutions include patching the Linux kernel to support $ORIGIN in PT_INTERP and shebangs, wrapping binaries with a small static launcher, or using language-specific relative path features. The author advocates for a kernel patch and suggests adding a relocatable = true metadata flag to Nix derivations.

5m read timeFrom fzakaria.com
Post cover image
Table of contents
How Do We Get There? 🗺️
292 Impressions