Nvidia 390 driver not working

I’ve corrected my previous message, libnvidia-tls.so must be in lib/tls and not in lib according to the arch thread.

Overriding postInstall didn’t work, so I had a look at the package and it turns out they use a custom builder script which override the installPhase without calling the pre and post hooks … So I just took the postFixup instead. This:

	  package = config.boot.kernelPackages.nvidiaPackages.legacy_390.overrideAttrs (old: {
	    postFixup = ''
		  rm $out/lib/libnvidia-tls.so*
		'';
	  });

But it doesn’t work ! It lets me boot X without problems, however glxinfo doesn’t work as it did with the LD_PRELOAD trick. Sure enough from the X log:

[    62.538] (EE) Failed to load /nix/store/nh7q72zijdzzf0v29cbd15sg3jw88qb3-nvidia-x11-390.157-6.1.68-bin/lib/xorg/modules/extensions/libglx.so: libnvidia-tls.so.390.157: cannot open shared object file: No such file or directory
[    62.538] (EE) Failed to load module "glx" (loader failed, 0)
$ ldd /nix/store/nh7q72zijdzzf0v29cbd15sg3jw88qb3-nvidia-x11-390.157-6.1.68-bin/lib/xorg/modules/extensions/libglx.so
        linux-vdso.so.1 (0x00007ffe6a9bb000)
        libnvidia-tls.so.390.157 => not found
        libnvidia-glcore.so.390.157 => /nix/store/76n9p37a92vv7z4ygl4j7hzhi06xlwbx-nvidia-x11-390.157-6.1.68/lib/libnvidia-glcore.so.390.157 (0x00007eff8d000000)
        libc.so.6 => /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/libc.so.6 (0x00007eff8ee18000)
        libdl.so.2 => /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/libdl.so.2 (0x00007eff900d2000)
        libm.so.6 => /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/libm.so.6 (0x00007eff8cf20000)
        /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib64/ld-linux-x86-64.so.2 (0x00007eff900db000)

So I will have to mess around with the nvidia-x11 package. But the override technique is a good one, I always forget that I can do this. Will check if I can override its lib, maybe with patchelf