There is also `nix-alien` (I am the author BTW), that automates the process of listing all program dynamic libraries (as long they're not loaded at runtime) and creating the `shell.nix` file with `buildFHSUserEnv`.
And also `programs.nix-ld` now, that allow you to impurely include libraries available to all programs. It does some LD_LIBRARY_PATH hacks, but AFAIK it worked well enough for me when I had this in my system (I don't anymore since I barely run dynamically linked executable from other sources).
Thanks. Try `tone`[1] my pet project. I'm pretty sure it won't work without tinkering out of the box. Since I need a dev machine, that supports my FOSS projects, NixOS is not for me :-) BTW it was not the ONLY reason, I ditched it, but the main reason. There were a lot of nice advantages to NixOS, but they did not outweight the issues I personally had.