matthewbauer / nix-bundle

Bundle Nix derivations to run anywhere!
MIT License
639 stars 46 forks source link

Export to .deb, .rpm… #93

Open tobiasBora opened 1 year ago

tobiasBora commented 1 year ago

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

tgunnoe commented 1 year ago

There's already support for toDeb and toRpm in the official bundlers (which also use nix-bundle): https://github.com/nixos/bundlers

tobiasBora commented 1 year ago

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.