(Resolved) Combining different packages into a single package

Hi, Forum. This question is about symlinkJoin and the way nix-env manages user-profiles.

The task I’d like to solve is how to make one big derivation for all the packages I need (approx. 30 packages, including my custom scripts, custom Xfce components, but also Openoffice, chromium, etc.). The idea is to install them atomically with just one nix-env -i command.

I tried to do it with symlinkJoin but soon I found seriosus disadvantages: 1) it failed to deal with share/applications section, so no icons, no .*desktops. 2) It doesn’t honor nix’s propagate-user-env-packages, it doesn’t add Qt5 when needed 3) It doesn’t provide any systematic way to resolve conflicts. Actually, symlinkJoin is built on top of lndir which is very dumb.

So I have to turn my attention to the nix-env itself that solves very same task when managing user-profiles. Do we have the functionality of nix-env at the nixpkgs level, e.g. as a better-than-symlinkJoin library function?

symlinkJoin is for the cases where the simplest and the most predictable approach is desired; for environment composition there is buildEnv.


Thanks! Exactly what I needed.

What is what you needed? buildEnv? Does that solve all your problems with symlinkJoin?

Yes, buildEnv. Looks like it is a drop-in replacement for symlinkJoin and it solved my problems.

Ref. https://github.com/grwlf/nixcfg/blob/3cefb977761e7342d1d4b667bcd8edb9d997d675/src/pkgs/myenv.nix#L43

1 Like