Nix failing when LIBRARY_PATH and LD_LIBRARY_PATH set

Hi,

I was wondering if someone can point me to the possible cause of the error.

I have nix installed and am loading additional software using environment modules (so they set PATH, LIBRARY_PATH and LD_LIBRARY_PATH).

With additional modules loaded, I get an error when I run nix that it can’t find libz.so.1. If I unload the environment module, everything works fine.

I was wondering what the cause could be and I think I am misunderstanding something. I originally thought programs in nix have their libraries linked so that they would not be influenced by dynamic linking. Any idea what could be happening?

Thanks

P.S. This is on an HPC environment with a nix installation into a custom nix-store directory, so a bit non-standard.