nixos-rebuild fails due to nvidia_x11.persistenced being null for legacy 304 driver:
"The option value 'environment.systemPackages.[34-entry 3]' in '/nix/var/nix/*/nvidia.nix' is not a package"
Thrown from https://github.com/NixOS/nixpkgs/blob/master/lib/modules.nix#L339
Enable driver: services.xserver.videoDrivers = [ "nvidiaLegacy304" ];
https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/hardware/video/nvidia.nix#L59 (removing persistenced from the list enables the nixos-rebuild)
https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/nvidia-x11/default.nix#L38 (which leads to persistenced to be null too)
It should be noted that the driver doesn't work on newer kernels anyway... search for nvidia and mtrr_add for details. Tried with 3.10 but seems to fail there too.
I think I got it right, but /cc @abbradar anyway.
Seems all good, thanks! (sorry for the spam)
@olejorgenb: thanks for the report! Otherwise the driver works OK on the default kernel?
@vcunat no, couldn't get it to work. For the default (4.x something i think) I got errors related to the mtrr_add and mtrr_del symbols (think it's the same as this), and for 3.10 (boot.kernelPackages = pkgs.linuxPackages_3_10;) sddm failed seemingly due to opengl problems. Got something like "opengl version mismatch". This was an old computer and I don't need the native driver that badly so at that point I gave up.
(The card is NVIDIA Quadro NVS 110M)
@olejorgenb: can you try this pair of commits? https://github.com/NixOS/nixpkgs/pull/26272 You probably want to pick them atop some version of 17.03. (My current GPU is too new for 304.)
@vcunat Success! Although neither gdm (didn't even start X AFAIC) or sddm (complained about opengl version) worked.
lightdm managed to display the login screen though :)
OT: Oh what a joy to use nixos when testing such things.. (rollback etc.) I first installed ubuntu on this laptop and the proprietary drivers failed there too. Suddenly I'm completely stuck without a graphical environment. And the driver is configured through a graphical program on ubuntu.. (is obviously possible to configure it using CLI too)
@olejorgenb Can you post glxinfo with those drivers and complaints from sddm? Maybe we can do something about those too...
Interesting... (guess it didn't work properly after all)
$ glxinfo
name of display: :0.0
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request: GLXBadContext
Major opcode of failed request: 155 (GLX)
Minor opcode of failed request: 6 (X_GLXIsDirect)
Serial number of failed request: 48
Current serial number in output stream: 47
glxgears fails too (no gears is displayed)
Looking in journalctl --boot 0 I find:
May 31 11:54:24 nixos systemd-modules-load[422]: Failed to find module 'nvidia-uvm'
... snip ...
May 31 11:54:26 nixos kernel: nvidia: loading out-of-tree module taints kernel.
May 31 11:54:26 nixos kernel: nvidia: module license 'NVIDIA' taints kernel.
May 31 11:54:26 nixos kernel: Disabling lock debugging due to kernel taint
May 31 11:54:26 nixos kernel: vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=io+mem,decodes=none:owns=io+mem
May 31 11:54:26 nixos kernel: [drm] Initialized nvidia-drm 0.0.0 20150116 for 0000:01:00.0 on minor
May 31 11:54:26 nixos kernel: NVRM: loading NVIDIA UNIX x86 Kernel Module 304.135 Tue Jan 17 14:54:17 PST 2017
I don't find anything suspicious in /var/log/X.0.log (https://ctrlv.it/id/31283/3322473375)
$ lsmod | grep nvidia
nvidia 10330112 31
drm 249856 3 nvidia
i2c_core 49152 2 nvidia,drm
agpgart 32768 4 nvidia,intel_agp,intel_gtt,drm
Strange... it'd be a difficult for me to test this by myself now -- if you have time, can you show me output of ls -la /run/opengl-driver/lib?
Note: it's i686 NixOS. I wonder if we have a bug that we don't setup EDIT: no, the code seems OK./run/opengl-driver-32 in that case...
We indeed don't setup (posted before your fix)./run/opengl-driver-32 on i686 arch but why would it be needed if /run/opengl-driver contains 32-bit libraries?
[root@nixos:/var/log]# ls -la /run/opengl-driver/lib
lrwxrwxrwx 1 root root 77 Jan 1 1970 /run/opengl-driver/lib -> /nix/store/06bjsizxz1l0qk6ii66d39y82qp49agj-nvidia-x11-304.135-4.9.29-bin/lib
(github keeps timing out on me)
EDIT: yeah, it's 32bit - should've mentioned that from the start
A-ha! Notice that for some reason bin output is linked to /lib! That would explain what's going on. Let me check a few things...
Could you try this patch: https://github.com/abbradar/nixpkgs/commit/a24283bda51c1adc4854dc1a0abd30e4926e11d7?
I believe we do setup an alias via ln -sfn opengl-driver /run/opengl-driver-32. It's important because mesa.driverLink will refer to /run/opengl-driver-32. It's used by vdpau and others. Major github outage is complicating the communication :-/
@vcunat Argh, I have believed that on i686 we just use opengl-driver and have assumed that before but you are correct. I'll check some code just in case I have implemented my assumptions. Thanks for noticing.
EDIT: seems everything is okay on my side. BTW (offtop) I work now on a PoC of generalizing /run/opengl-driver, GTK engine paths, Sane drivers and other LD_LIBRARY_PATH-like things to /run/current-system/${system}-lib. I'll post it when I have something initially working to ask if this is interesting.
It's required at least on some places, as we (want to) share 32-bit binaries for both platforms. Maybe it will be easier to always use only driver-32 name for 32-bit binaries.
@abbradar The glgears are running! :)
@olejorgenb Nice! I would expect GDM/SDDM are fixed, too (but the former didn't work without GNOME 3 -- it was some time ago though).
Yeah, just checked that sddm worked to be sure.
Pushed to master as d09e3535f526, also merged @vcunat's patches. Thank you for testing!
EDIT: also pushed to the release branch.