-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feedback: Nvidia Support #5
Comments
Dear @soupglasses, I am very new to Nix so I tried to dig into the documentation but couldn't find a proper solution a couple of things. # For Ubuntu users.
sudo env "PATH=$PATH" nix run 'github:numtide/system-manager' -- switch --flake '.' When you want to activate the system manager it needs sudo rights and it's a mess because usually Nix is installed in the user space only. In any case that would be very helpful to add for users to avoid spending time on this small issue. Here is my flake:
EDIT: ->I tried this `system-graphics.package = pkgs.linuxKernel.packages.linux_libre.nvidia_x11_legacy535.override { libsOnly = true; kernel = null; };`
But when I run "kitty" I got:
``` [0.091] [glfw error 65543]: GLX: Failed to create context: BadValue (integer parameter out of range for operation)
[0.091] Failed to create GLFW temp window! This usually happens because of old/broken OpenGL drivers. kitty requires working OpenGL 3.1 drivers.```
Again you did a great job! It feels much less hacky than the NixGL tutorials I have seen so far. Best |
Hi there thanks for the feedback! I'll get a more detailed response here later today for you. But if you are able to open up your Nvidia settings and check which version of the driver you have installed and report back. That'd be more than helpful. |
Here is the snippet of the code I used: {
description = "Home Manager configuration for mnaveau";
inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
system-manager = {
url = "github:numtide/system-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-system-graphics = {
url = "github:soupglasses/nix-system-graphics";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, system-manager, nix-system-graphics, ... }:
let
system = "x86_64-linux";
username = "mnaveau";
# pkgs = nixpkgs.legacyPackages.${system};
pkgs = import nixpkgs { system = "x86_64-linux"; config.allowUnfree = true; };
in {
defaultPackage.x86_64-linux = home-manager.defaultPackage.x86_64-linux;
defaultPackage.x86_64-darwin = home-manager.defaultPackage.x86_64-darwin;
systemConfigs.default = system-manager.lib.makeSystemConfig {
modules = [
nix-system-graphics.systemModules.default
({
config = {
nixpkgs.hostPlatform = "${system}";
system-manager.allowAnyDistro = true;
system-graphics.enable = true;
# system-graphics.package = pkgs.linuxPackages.nvidia_x11.override { libsOnly = true; kernel = null; };
system-graphics.package = pkgs.linuxKernel.packages.linux_libre.nvidia_x11_legacy535.override { libsOnly = true; kernel = null; };
};
})
];
};
homeConfigurations = {
"${username}" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ ./home.nix ];
};
};
};
} Here the output of |
Sorry for not getting back earlier, this should help you get it working: You can either run home-manager switch to get the You can then check if it worked with the following command: nix shell 'nixpkgs#mesa-demos' --command glxgears If there is anything else, feel free to ask! 😄 {
description = "Home Manager configuration for mnaveau";
inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
system-manager = {
url = "github:numtide/system-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-system-graphics = {
url = "github:soupglasses/nix-system-graphics";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, system-manager, nix-system-graphics, ... }:
let
system = "x86_64-linux";
username = "mnaveau";
# pkgs = nixpkgs.legacyPackages.${system};
pkgs = import nixpkgs { system = "x86_64-linux"; config.allowUnfree = true; };
in {
defaultPackage.x86_64-linux = home-manager.defaultPackage.x86_64-linux;
defaultPackage.x86_64-darwin = home-manager.defaultPackage.x86_64-darwin;
systemConfigs.default = system-manager.lib.makeSystemConfig {
modules = [
nix-system-graphics.systemModules.default
({
config = {
nixpkgs.hostPlatform = "${system}";
system-manager.allowAnyDistro = true;
system-graphics = let
nvidia-drivers = pkgs.linuxPackages.nvidia_x11_legacy535.override {
libsOnly = true;
kernel = null;
};
in {
enable = true;
enable32Bit = true;
package = nvidia-drivers;
package32 = nvidia-drivers.lib32;
};
};
})
];
};
devShells."${system}".default = pkgs.mkShellNoCC {
packages = [
system-manager.packages."${system}".default
];
};
homeConfigurations = {
"${username}" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
({
home.packages = [ system-manager.packages."${system}".default ];
})
];
};
};
};
} |
Hi, But I got no luck running the glxgear nor kitty.
If you have any clue or guideline I would be very interested. |
Still no luck after after the switch command when I run
I believe the version of nvidia are slightly different. Could that be the issue? |
I'd be surprised. But you can try to generate it manually. Put it where your previous definition of nvidia-drivers are. nvidia-drivers = (pkgs.linuxPackages.nvidiaPackages.mkDriver {
version = "535.183.01";
sha256_64bit = "sha256-9nB6+92pQH48vC5RKOYLy82/AvrimVjHL6+11AXouIM=";
sha256_aarch64 = "";
openSha256 = "";
settingsSha256 = "";
persistencedSha256 = "";
patches = pkgs.linuxPackages.nvidiaPackages.legacy_535.patches;
}).override { libsOnly = true; kernel = null; }; |
Updated the comment a bit to also include the patches for 535. Unsure if its needed when we just build the libs, but i added them to be sure. |
Also please run Also try to reboot if the above doesnt work either. |
It seems that the installation of the exact version and patches are needed in order for things to work... I designed this simple update scripts in order to make things easier for me: home-manager switch --flake .
sudo env "PATH=$PATH" system-manager switch --flake . Seems that now I can run graphical software from the nixpkgs. |
I'm using Linux Mint 22 (Ubuntu based) with Nvidia Driver 550.120 and kernel 6.8.0-48 on my Lenovo Legion Slim 5 16AHP9 with an RTX 4070 card. I can confirm that it only works when I use the exact same driver version which is installed on system level.
nvidia-drivers =
(pkgs.linuxPackages.nvidiaPackages.mkDriver {
# use same version as OS version from /proc/driver/nvidia/version
version = "550.120";
sha256_64bit = "sha256-gBkoJ0dTzM52JwmOoHjMNwcN2uBN46oIRZHAX8cDVpc=";
sha256_aarch64 = "";
openSha256 = "";
settingsSha256 = "";
persistencedSha256 = "";
patches = pkgs.linuxPackages.nvidiaPackages.production.patches;
}).override
{
libsOnly = true;
kernel = null;
}; If I use any other version (v550.78 from nixpkgs/nixos-24.05 or v550.127.05 from nixpkgs/unstable) I get the # results in error "BadValue (integer parameter out of range for operation)" when running glxgears
nvidia-drivers = pkgs.linuxPackages.nvidia_x11_production.override {
libsOnly = true;
kernel = null;
}; |
Huh. Very interesting. I wonder how this works when the open kernel driver is used. Maybe its not so tied to versions like this. But this might just be a genuine limitation for nvidia drivers. |
This has stopped working for me on a new laptop install.
As a sidenote, curiously, EDIT: It seems they couldn't find the mesa lib paths, I had to add |
No description provided.
The text was updated successfully, but these errors were encountered: