Packaging software for other distributions

Nix package manager is getting into more and more platforms. It is now available on MacOS and android. Therefore I am considering to switch into nix based reproducible environments at work. However as a developer I need to release software releases for other platforms. How the one can produce a release of a software in a form of:

  • a debian or redhat package for FHS based distribution.
  • a dmg package for MacOS

The buildFHSUserEnv wouldn’t work on MacOS. Full blown VM would have the same problems as docker on mac (slow filesystem binds). PatchELF would be too hacky. Any other options?

2 Likes

Personally I use docker, VM and CI to produce RPMs, DEBs and python packages, though luckily I don’t have to deal with Mac’s.

Though on a Mac, you should be able to use Mac tooling to build Mac stuff. It’s not getting removed when you install nix, is it?

2 Likes

Though on a Mac, you should be able to use Mac tooling to build Mac stuff. It’s not getting removed when you install nix, is it?

Usually project development involves setting up environment with all dependencies. We use different platforms in our team. Some people on Linux, others on MacOS. I am on a search for a tool which can fetch and install dependencies to create reproducible envirnoments. We also use different versions of some dependencies for different versions of a project. Development in docker is horrible on MacOS. I’ve considered:

  • nix

  • habitat

  • combination of direnv and bash to modify LD_PRELOAD (DYLD_INSERT_LIBRARIES on mac) and PATH
    However I quickly discovered that none of the approaches really work. LD_PRELOAD hacks are to expensive to maintain. Habitat.sh and nix are producing binaries which cannot run on system which do not have nix (or habitat) installed. It looks like we need to forget about reproducible environments for now and stick to manual installation or spend time to develop the approach. Possible options:

  • specification + git fetcher + direnv + LD_PRELOAD/PATH hacks

  • generic wrapper for nix binaries which would rewrite access to /nix with access to system libraries or libraries in standard directories.

    • fuse
    • syscall rewrite
    • custom dynamic linker loader (similar to /lib/ld-linux.so.2 but with different name)
    • re-target final binary using patchelf - unlikely to work

nix-bundle exists and is being integrated into nix, however it uses nix-user-chroot which does not work on MacOS. Perhaps a similar alternative could be considered for your needs?

4 Likes