Making `/lib64/` available

Is there a way that I can make /lib64/ available without having to wrap things in a shell or something similar as is discussed in How to deal with `/lib64/` missing on NixOS?. I know that that is not how NixOS should be used, but now after a few years I’m done fighting it. For example, if I download a new version of Julia (, then I can run the binary after I have patched bin/julia and libexec/7z. By patching, I mean that I change the interpreter from

$ patchelf --print-interpreter bin/julia

to, for example,

$ patchelf --print-interpreter bin/julia

I don’t think that it makes sense to wrap each the binary invokation in some kind of shell. Literally the only thing is that a symlink is missing.

So, basically, my question is: Can I create a symlink via the NixOS config?

Yes, you can.

And I know @gytis-ivaskevicius does or did this in their repository, though I was not able to find it quickly.

Perhaps you have better luck? Or they chime in as usual and just point you to the right location in their config.

Yes. Adding

system.activationScripts.ldso = lib.stringAfter [ "usrbinenv" ] ''
    mkdir -m 0755 -p /lib64
    ln -sfn ${pkgs.glibc.out}/lib64/ /lib64/
    mv -f /lib64/ /lib64/ # atomically replace

works :partying_face: Thanks @NobbZ and @gytis-ivaskevicius

1 Like

There is also: GitHub - Mic92/nix-ld: Run unpatched dynamic binaries on NixOS

Hosted by Flying Circus.