I have been maintaining installation scripts for several bioinformatic programs using nix. Nix works beautifully on the latest version of Archlinux and other Linux distributions.
Now, I am trying to use nix to compile programs in an HPC environment with CentOS 8. Obviously, I have no root privilege, and I get around it with nix-user-chroot
. Nix used to work beautifully on CentOS 7 and 8, but as Nix gets updated, the glibc and libstdc++ on older Linux distributions are now causing compilation issues.
My first attempt to install nix on CentOS 8 was thwarted by a glibc and libstdc++ issue.
I tried installing updated versions of glibc and libstdc++ and running the nix install script, but then the system’s bash, dirname, and mkdir, etc. were not compatible with the version of glibc and libstdc++ that the nix binary required.
So, I obtained the static binary of nix from Hydra - nix:master:buildStatic.x86_64-linux and I replaced the standard version of the nix binary with this static binary. I then set up symlinks from nix-env, nix-channel to the static nix binary. I managed to run the nix install script.
nix-channel complained about missing nix-env at a specific /nix/store location, which was solved with a few symlinks.
I even managed to compile a program using nix, and I thought things were looking really good…
$ nix-env -i fastp
Then, I tried to run the program compiled with nix:
$ fastp
fastp: /usr/lib64/libc.so.6: version `GLIBC_2.33' not found (required by fastp)
fastp: /usr/lib64/libc.so.6: version `GLIBC_2.34' not found (required by fastp)
This was the same glibc linkage error that I started with when the nix installation script tried to run nix-env
during installation…
Sure, I can set up my LD_LIBRARY_PATH
to point to the updated versions of glibc, but I’d run into the same issue as before where my system binaries depend on older versions of glibc whereas programs compiled with nix depend on new versions of glibc.
So, can anyone suggest a viable way to use nix on a Linux distribution (e.g. CentOS 8) that relies on outdated versions of glibc and libstdc++?