Xorg is still using the wrong libglx.so with the Nvidia Legacy 390 driver

Over the past few days I’ve been busy trying to make the GT 610 work (my workplaces sucks), but even after switching from Wayland to Xorg it keeps falling back to a software renderer. During that time, I’ve come across a few relevant posts, especially this one. It should’ve solved the issue, but it is still there:

(II) "glx" will be loaded by default.
(II) LoadModule: "glx"
(II) Loading /nix/store/fcqqj50800cprqzg9fab7sylgv4manax-xorg-server-21.1.20/lib/xorg/modules/extensions/libglx.so
(II) Module glx: vendor="X.Org Foundation"
        compiled for 1.21.1.20, module version = 1.0.0
        ABI class: X.Org Server Extension, version 10.0
(II) LoadModule: "nvidia"
(II) Loading /nix/store/24ynn66b5f76103nqqny3qwqfawzh55j-nvidia-x11-390.157-6.12.58-bin/lib/xorg/modules/drivers/nvidia_drv.so
(II) Module nvidia: vendor="NVIDIA Corporation"
        compiled for 4.0.2, module version = 1.0.0
        Module class: X.Org Video Driver
(**) NVIDIA(0): Enabling 2D acceleration
(EE) NVIDIA(0): Failed to initialize the GLX module; please check in your X
(EE) NVIDIA(0):     log file that the GLX module has been loaded in your X
(EE) NVIDIA(0):     server, and that the module is the NVIDIA GLX module.  If
(EE) NVIDIA(0):     you continue to encounter problems, Please try
(EE) NVIDIA(0):     reinstalling the NVIDIA driver.

Relevant configuration:

{
  config,
  lib,
  pkgs,
  modulesPath,
  ...
}:
{
  boot.extraModulePackages = [ config.boot.kernelPackages.nvidiaPackages.legacy_390 ];
  boot.blacklistedKernelModules = [
    "nouveau"
  ];

  hardware.graphics = {
    enable = true;
    enable32Bit = true;
    extraPackages = with pkgs; [
      config.boot.kernelPackages.nvidiaPackages.legacy_390
    ];
  };

  nixpkgs.config.nvidia.acceptLicense = true;
  hardware.nvidia = {
    package = config.boot.kernelPackages.nvidiaPackages.legacy_390;
    modesetting.enable = true; 
    nvidiaSettings = true;
    open = false;
    prime = {
      sync.enable = true; 
      nvidiaBusId = "PCI:1:0:0";
      intelBusId = "PCI:0:2:0";
    };
  };

  services.xserver = {
    videoDrivers = [
      "nvidia"
      "nvidiaLegacy390"
    ];

    modules = [ config.boot.kernelPackages.nvidiaPackages.legacy_390 ];
    exportConfiguration = true;
  };

}

I am yet to solve this…

OK, kind of fixed it with an override, seems like for whatever reason packages wasn’t symlinking libglx.so.390.157 to libglx.so, so:

let
  novideo = config.boot.kernelPackages.nvidiaPackages.legacy_390.overrideAttrs (old: {
    postFixup = ''
      ln -sf $bin/lib/xorg/modules/extensions/libglx.so.390.157 $bin/lib/xorg/modules/extensions/libglx.so
    '';
  });
in

And Xorg log now shows:

(II) Loading /nix/store/91b7bjyk3b7ndf5pnr31iqa1j1qbinfg-nvidia-x11-390.157-6.12.58-bin/lib/xorg/modules/extensions/libglx.so
(II) Module glx: vendor="NVIDIA Corporation"
        compiled for 4.0.2, module version = 1.0.0
        Module class: X.Org Server Extension
(II) NVIDIA GLX Module  390.157  Wed Oct 12 09:19:15 UTC 2022
...
(**) NVIDIA(0): Enabling 2D acceleration
...

Yet in xrdp I still get llvmpipe as OpenGL renderer :new_moon_with_face:

Cool, I wonder if that shouldn’t be submitted as a PR upstream.

Just to make sure these ids are correct, please run

nix --experimental-features "flakes nix-command" run github:eclairevoyant/pcids