nix-bundle
nix-bundle copied to clipboard
Export to .deb, .rpm…
It would be great to provide a way to bundle deb/rpm/… packages. While nix's derivation are made to work when running in /nix/store, I guess in 95% of the cases we can easily "unpatch" them to run in a regular FHS path, by removing RPATH, wrappers, and by patching back elf files to point to /lib. And dependencies could be obtained by reading some database, similar to how nix-index works bbut for other systems… or by manually listing them or using passthru.
This could provide a huge value to Nix as discussed here https://discourse.nixos.org/t/automatically-generating-deb-packages-from-nixpkgs/25420/18
There's already support for toDeb and toRpm in the official bundlers (which also use nix-bundle): https://github.com/nixos/bundlers
Thanks for the pointer, but as I understand it recreates stuff in /nix/store (based of fpm, see code in https://github.com/juliosueiras-nix/nix-utils/blob/b44e1ffd726aa03056db9df469efb497d8b9871b/utils/rpm-deb/default.nix#L129), so it's certainly more reliable, but it is less interesting for true packaging as it does not share libraries with the host system.