That would make sense. Maybe get the LTS kernel instead?
My kernel was 6.1. Will try boot.kernelPackages = pkgs.linuxPackages_zen;
. It’s supposed to give me kernel 6.6.1. I am still not sure what kernel.kernelAtLeast
means though. I assume the kernel has to be minimum v6.2 for the package to work?
I’d read that it has to be at least 6.2 for the package to be broken. Without checking what the function actually does, I’d say it evaluates to true on kernel 6.2 and above. Hence the package should be broken on kernel 6.2 and above.
Why are you using the zen kernel? That one is modified. No idea what that will do in your case.
Oh, so I’m supposed to run a kernel that is 6.1 or older?
Well, I am not sure about the exact nature of your config. But what I can gather from this is that this package legacy_390
is likely to not work on kernel 6.2 and above.
I myself am running 6.1.63
on this machine right now btw. (Edit: I just use linuxPackages
as kernel packages for NixOS, which should give you the LTS. According to kernel.org
this is at 6.1.69 right now.)
Generally speaking I am also not totally familiar with what your system configuration as a whole is. It appears to be somewhat older, based on Intel Ivy Bridge or Haswell or so. Also your Nvidia driver is not very up to date, is that because your GPU is not supported by newer versions?
You’re right! I went back to the default LTS kernel, 6.1.65
. However, it still didn’t install. I had to manually add linuxKernel.packages.linux_6_1.nvidia_x11_legacy390
to environment.systemPackages
. And indeed it did install without issues. I guess the hardware.nvidia
config doesn’t support old drivers or something, not sure.
Yes, my hardware is old, the GPU is so old that it doesn’t even support vulkan lol.
I think I’m getting closer. I just need to figure out how to load the nvidia
kernel module because bumblebee
shows this error nixos bumblebeed[910]: Could not load GPU driver
. I wonder if I should add "nvidia"
to the boot.initrd.kernelModules
list. I already added it to the boot.kernelModules
one.
I just need to figure out how to load the
nvidia
kernel module
That would most likely be a big step forward.
At this point I have to ask: Is your GPU even supported by the legacy 390 drivers? Which GPU are you running?
Yes, it is. I checked the Nvidia website, and used to run it when I was running Arch. It is working now, but bumblebee for some reason installs a different version of the Nvidia driver. Thanks for your help!
I need to override this dependency somehow and make it nvidia_x11_legacy390
Is this the correct way to do it?
nixpkgs.overlays = [
(final: prev: {
bumblebee = prev.bumblebee.override { nvidia_x11 = prev.nvidia_x11_legacy390; };
})
];
Hi @shico,
I got the same problem for my old 4200M card.
Did you fix your issue ? I so, can you post you configuration.nix
file (at least the part concerned by your kernel, opengl and nvidia) ?
Thanks,
Andréas
Hi,
I think I went a bit further, thanks to this topic : Nvidia 390 driver not working - #3 by the_pumpkin_man
videoDriver must be nvidia
in order to be able to load the kernel module.
services.xserver.videoDrivers = [ "nvidia" ];
After that, the kernel module is loaded, got nvidia-settings
in my path, but it doesn’t find any display.
In the end, I still don’t know if my GPU is in use or if the integrated intel GPU is used.
Also, my laptop performances seems ok but the mouse is lagggging a lot which make it unusable.
Hope we’ll find a solution to this problem.
And, does anyone know how to check if your nvidia GPU is compatible with optimus ? Nvidia has a website : Optimus | Supported GPUs | GeForce but it seems completely broken…
If my card is not supported by optimus, how can the intel card and nvidia one work together ?
For info here is the output of nvidia-smi
:
$ nvidia-smi
Fri Mar 22 16:57:25 2024
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.157 Driver Version: 390.157 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 NVS 4200M Off | 00000000:01:00.0 N/A | N/A |
| N/A 53C P8 N/A / N/A | 1MiB / 454MiB | N/A Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 Not Supported |
+-----------------------------------------------------------------------------+
And the result of nvidia-settings
:
ERROR: Unable to find display on any available system
The mouse seems to lag less when the laptop is on battery, but not sure. And it fixes my HDMI audio output problem which is already a nice thing .
@AndreasL I have the exact same problem (thinkpad T530 with Nvidia NVS5400M which uses Legacy390 driver). And I also had the exact same configuration as you. Up until a few days ago, it was working fine, I assume you run unstable. However after updating my channel and rebuilding nixos, I have the same problem now, nvidia driver doesn’t detect any displays and the system runs with software acceleration, so I assume something broke recently. (Note that offload isn’t supported in 390, so only sync mode works).
Hello @ClockGen,
No I’m running on stable channel with NixOs 23.11.
Here is my config for my nvidia :
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
# Load nvidia driver for Xorg and Wayland
# It's important to just put "nvidia" and not "nvidiaLegacy390"
services.xserver.videoDrivers = ["nvidia"];
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 = {
sync.enable = true;
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
# Needed for nvidia drivers
nixpkgs.config.nvidia.acceptLicense = true;
environment.systemPackages = with pkgs; [
# See https://discourse.nixos.org/t/nvidia-settings-and-nvidia-offload-not-found/37187/14?u=andreasl
linuxKernel.packages.linux_6_1.nvidia_x11_legacy390
];
My real problem is about HDMI sound output which doesn’t with nouveau, and works with nvidia legacy.
Otherwise, I wouldn’t mind using nouveau, I don’t need a great performances…
Hello Guys,
I’m facing a very similar issue, I have old Hardware and trying to make it work:
- I need to use
nvidiaLegacy390
(GPU model: Nvidia NVS 300), I still use VGA (sorry guys lol)
why:
the OS works overall but the text is blurry on some places and I’m getting headache by watching the Screen, before I go to last option (buy an new PC with better hardware) I’m trying now to downgrade the kernel thanks to the hint from @shico
I’m a newbie in NixOS (I love it btw.) and in Linux but already setup a bit flake, home-manager - I was asking myself if I should build the kernel with --flake option, I guess yes? ah and for nvidia-settings
commands I get command not found
Would appreciate if someone finds an solution, I would save some money
Thanks in Advance
@AndreasL
Sorry for the late reply, I’ve just seen your post. Currently I have this configuration which works well on the latest stable version of NixOS.
(Will share only relevant parts, if you want the complete file, you can tell me)
flake.nix
:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
};
outputs = {
nixpkgs,
...
} @ inputs: {
nixosConfigurations = {
"nixos" = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
specialArgs = rec {
inherit (inputs) nixpkgs;
pkgs = import nixpkgs {
system = system;
config.allowUnfree = true;
config.nvidia.acceptLicense = true;
overlays = [
(final: prev: {
bumblebee = prev.bumblebee.override {
nvidia_x11 = pkgs.linuxKernel.packages.linux_6_1.nvidia_x11_legacy390;
extraNvidiaDeviceOptions = "BusID \"PCI:1:0:0\"";
};
})
(final: prev: let
xmodules = pkgs.lib.concatStringsSep "," (
map (x: "${x.out or x}/lib/xorg/modules") [
pkgs.xorg.xorgserver
pkgs.xorg.xf86inputmouse
]
);
in {
bumblebee = prev.bumblebee.overrideAttrs (old: {
nativeBuildInputs =
old.nativeBuildInputs
++ [
pkgs.xorg.xf86inputmouse
];
CFLAGS = [
"-DX_MODULE_APPENDS=\\\"${xmodules}\\\""
];
});
})
];
};
modules = [
./configuration.nix
./hardware-configuration.nix
];
};
};
};
}
hardware-configuration.nix
:
{
config,
lib,
pkgs,
modulesPath,
...
}: {
boot.kernelPackages = pkgs.linuxPackages.extend (self: super: {
nvidia_x11 = super.nvidia_x11_legacy390;
});
services.xserver.videoDrivers = [
"modesetting"
"nvidiaLegacy390"
];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.legacy_390;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
hardware.bumblebee.enable = true;
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
intel-media-driver
(vaapiIntel.override {enableHybridCodec = true;})
vaapiVdpau
libvdpau-va-gl
];
};
}
configuration.nix
:
{
nixpkgs,
pkgs,
pkgs-unstable,
...
}: {
environment.systemPackages = with pkgs; [
linuxKernel.packages.linux_6_1.nvidia_x11_legacy390
];
}
Running nvidia-smi
in this configuration doesn’t work of course.
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
You would have to use it like this optirun nvidia-smi
:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.157 Driver Version: 390.157 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 NVS 5200M Off | 00000000:01:00.0 N/A | N/A |
| N/A 47C P0 N/A / N/A | 5MiB / 964MiB | N/A Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 Not Supported |
+-----------------------------------------------------------------------------+
Thanks for your reply,
I tried to replicate your configuration, but got problems compiling it.
First, I was not using flake, so I activated it.
Then, my hardware-configuration.nix
is specified to be automatically generated, so I didn’t touch it, so I copied all your hardware stuff in configuration.nix
.
I think it quite OK but got a very obscure error when calling sudo nixos-rebuild switch
:
warning: creating lock file '/etc/nixos/flake.lock'
error: flake 'path:/etc/nixos' does not provide attribute 'packages.x86_64-linux.nixosConfigurations."nixos".config.system.build.nixos-rebuild', 'legacyPackages.x86_64-linux.nixosConfigurations."nixos".config.system.build.nixos-rebuild' or 'nixosConfigurations."nixos".config.system.build.nixos-rebuild'
Here is my flake.nix
file (the system = system
line was creating an error so I just copied the system
value) :
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
};
outputs = { self, nixpkgs } @inputs : {
# replace 'joes-desktop' with your hostname here.
nixosConfigurations.joes-desktop = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = rec {
inherit (inputs) nixpkgs;
pkgs = import nixpkgs {
system = "x86_64-linux";
config.allowUnfree = true;
config.nvidia.acceptLicense = true;
overlays = [
(final: prev: {
bumblebee = prev.bumblebee.override {
nvidia_x11 = pkgs.linuxKernel.packages.linux_6_1.nvidia_x11_legacy390;
extraNvidiaDeviceOptions = "BusID \"PCI:1:0:0\"";
};
})
(final: prev: let
xmodules = pkgs.lib.concatStringsSep "," (
map (x: "${x.out or x}/lib/xorg/modules") [
pkgs.xorg.xorgserver
pkgs.xorg.xf86inputmouse
]
);
in {
bumblebee = prev.bumblebee.overrideAttrs (old: {
nativeBuildInputs =
old.nativeBuildInputs
++ [
pkgs.xorg.xf86inputmouse
];
CFLAGS = [
"-DX_MODULE_APPENDS=\\\"${xmodules}\\\""
];
});
})
];
};
modules = [ ./configuration.nix ];
}
};
};
}
Sorry, I’m very new to nix, this problem may be obvious…
I’m not sure why it does not work. Have you tried just getting it work with flakes first without the overlay for bumblebee?
[Update]:
Copying and pasting your code snippet in my editor showed an error, you’re missing a semi-column at line 93, after the closing brace of specialArgs
.
Same error, so it’s not about your overlay.
Nice catch, but it wasn’t the problem. I will try to fond a solution for my flake
problem and then test back your overlay, thanks !