Need help to install Nvidia Driver for a 4200M

Hi,

I just installed NixOs 23.11 on a Dell Latitude E6520 laptop with a Nvidia 4200M graphic card and try to install nvidia legacy driver on it.

I followed the instructions in the wiki : Nvidia - NixOS Wiki

And add that to my configuration.nix file :

# Try to add support for my Nvidia 4200M which is listed as 390.xx legagy driver here : 
  # https://www.nvidia.com/en-us/drivers/unix/legacy-gpu/
  # Configuration based on : https://nixos.wiki/wiki/Nvidia
  # Enable OpenGL
  hardware.opengl = {
    enable = true;
    driSupport = true;
    driSupport32Bit = true;
  };

  # Load nvidia driver for Xorg and Wayland
  services.xserver.videoDrivers = ["nvidiaLegacy390"];
  hardware.nvidia = {

    # Modesetting is required.
    modesetting.enable = true;

    # Nvidia power management. Experimental, and can cause sleep/suspend to fail.
    # Enable this if you have graphical corruption issues or application crashes after waking
    # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead 
    # of just the bare essentials.
    powerManagement.enable = false;

    # Fine-grained power management. Turns off GPU when not in use.
    # Experimental and only works on modern Nvidia GPUs (Turing or newer).
    powerManagement.finegrained = false;

    # Use the NVidia open source kernel module (not to be confused with the
    # independent third-party "nouveau" open source driver).
    # Support is limited to the Turing and later architectures. Full list of 
    # supported GPUs is at: 
    # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus 
    # Only available from driver 515.43.04+
    # Currently alpha-quality/buggy, so false is currently the recommended setting.
    open = false;

    # Enable the Nvidia settings menu,
	# accessible via `nvidia-settings`.
    nvidiaSettings = true;

    # Optionally, you may need to select the appropriate driver version for your specific GPU.
    package = config.boot.kernelPackages.nvidiaPackages.legacy_390;
    
    # see : https://nixos.wiki/wiki/Nvidia#Laptop_Configuration:_Hybrid_Graphics_.28Nvidia_Optimus_PRIME.29
    prime = {
    	intelBusId = "PCI:0:2:0";
    	nvidiaBusId = "PCI:1:0:0";
    };
  };

Then I hit : sudo nixos-rebuild switch

Got no errors and reboot without problem, but it seems that nvidia driver is not in use and it’s event not installer (don’t have nvidia-settings for instance).

If I understand the result of lshw, it still use the nouveau driver :

sudo lshw -c display
[sudo] Mot de passe de dede : 
  *-display                 
       identifiant matériel: 0
       information bus: pci@0000:01:00.0
       version: a1
       bits: 64 bits
       horloge: 33MHz
       fonctionnalités: pm msi pciexpress bus_master cap_list rom
       configuration: driver=nouveau latency=0
       ressources: irq:31 mémoire:e4000000-e4ffffff mémoire:d0000000-dfffffff mémoire:e0000000-e1ffffff portE/S:4000(taille=128) mémoire:e5000000-e507ffff
  *-display
       produit: i915drmfb
       identifiant matériel: 2
       information bus: pci@0000:00:02.0
       nom logique: /dev/fb0
       version: 09
       bits: 64 bits
       horloge: 33MHz
       fonctionnalités: msi pm bus_master cap_list rom fb
       configuration: depth=32 driver=i915 latency=0 resolution=1920,1080
       ressources: irq:32 mémoire:e5400000-e57fffff mémoire:c0000000-cfffffff portE/S:5000(taille=64) mémoire:c0000-dffff

There is no log about nvidia : journalctl -k -b --grep “nvidia” returns nothing

Here is lspci result :

lspci
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (Lewisville) (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)
00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)
00:1c.2 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 3 (rev b4)
00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b4)
00:1c.5 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 6 (rev b4)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation QM67 Express Chipset LPC Controller (rev 04)
00:1f.2 RAID bus controller: Intel Corporation 82801 Mobile SATA Controller [RAID mode] (rev 04)
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 04)
01:00.0 VGA compatible controller: NVIDIA Corporation GF119M [NVS 4200M] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GF119 HDMI Audio Controller (rev a1)
03:00.0 Network controller: Intel Corporation Centrino Ultimate-N 6300 (rev 35)
0b:00.0 FireWire (IEEE 1394): O2 Micro, Inc. 1394 OHCI Compliant Host Controller (rev 05)
0b:00.1 SD Host controller: O2 Micro, Inc. OZ600RJ0/OZ900RJ0/OZ600RJS SD/MMC Card Reader Controller (rev 05)
0b:00.2 Mass storage controller: O2 Micro, Inc. O2 Flash Memory Card (rev 05)

Any idea ?

EDIT : Someone has the same problem, didn’t find it before sorry for double posting : Nvidia-settings and nvidia-offload not found - #18 by shico