Unable to use nixpkgs.git on RHEL 7


I recently started using nixpkgs (single-user install) on a system running RHEL 7.8 that uses NFS-mounted home directories (but the /nix directory is on local storage). The system version of git was quite old, and was causing warnings from emacs/magit, so I used nix (specifically nix-env -iA nixpkgs.git) to install git. The nixpkgs channel is set to nixpkgs-unstable release nixpkgs-21.11pre326916.7053541084b. I expected that everything would just work, however, it does not. Executing git fetch or git push (whether on the nfs mount, or a local drive) results in an error similar to the following:

No user exists for uid xxxx
fatal: Could not read from remote repository

Please make sure you have the correct access rights
and the repository exists.

If, however, I use /usr/bin/git (to make sure I’m using the system git), then git fetch/push works as expected. I’ve tried to search here, on the web, and in the nixpkgs issues, and the closest I’ve come is problems with libnss and glibc during a big libnss version bump with breaking changes. Note that installing coreutils, and using the ls command from coreutils, results in seeing the uid/gid of directory entries instead of the user and group names. I’ll gladly try overlays, overrides, or whatever else, as I’d really like to start using home-manager/nixpkgs on this system, but I’m not sure where to go from here.

Does anyone have any suggestions for information gathering or a solution?

I had similar issue with sssd on RHEL. I think the reason is libnss in nixpkgs doesn’t come with support for sssd. I fixed it by creating a new directory, symlinking /lib64/libnss_sss.so.2 to that directory, then adding it to LD_LIBRARY_PATH. Or you can probably use LD_PRELOAD. I am interested if there are any other solutions to that.

Thanks for the suggestion: under the assumption that (perhaps) the lack of the libnss_sss.so.2 was the problem, I created a symlink and added it to LD_LIBRARY_PATH. However, I believe the version of libnss_sss.so.2 in RH7 is too old, because that did not change the error message.

My next attempt may be to try building an overlay for git that uses the system libnss files, but I’d rather figure out a way to keep the nix and system items separate and use the tools provided by nix.

I think the situation is exactly as explained. One solution that works incredibly well is to install nscd on the box (using the system package manager).
Everything should work just fine after that without having to tinker with LD_LIBRARY_PATH.


Thank you! Installing nscd using the system tools, then enabling and starting the nscd service, allowed me to use the nix-pkgs version of git with no changes to my LD_LIBRARY_PATH. So, the following sequence of commands (for future readers) worked:

yum install nscd
systemctl enable nscd
systemctl start nscd

Once nscd was started, the nixpkgs version of git started working.