Skip to content
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

nixos/nvidia: assert open option is manually set on drivers >= 560 #339025

Merged

Conversation

getchoo
Copy link
Member

@getchoo getchoo commented Sep 2, 2024

Description of changes

This requirement was introduced in #337289 as a way to make sure users "explicitly pick which version of the driver they want since nvidia recommends the open one, but that is incompatible with older drivers". This is reasonable, however the user isn't informed in any real way aside from the upcoming release notes

This has caused a good amount of confusion amongst users. By introducing this assertion and using a new useOpenModules local variable, we can have the same behavior but display a proper error message to hopefully clear things up until we can safely make this a default

#338362 was also mentioned as an alternative to this here, however given our special case of it only needing to be set sometimes, I believe giving this message explicitly is a lot more user friendly

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Sep 2, 2024
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 1-10 labels Sep 2, 2024
@Kranzes
Copy link
Member

Kranzes commented Sep 5, 2024

I think there are some implications to this change that need to be considered. Nvidia does not recommend and does not support (?) GPUs prior to Turing with the open drivers. This change might cause the GPU to stop working for users with an older Nvidia GPU.

@getchoo
Copy link
Member Author

getchoo commented Sep 5, 2024

This change might cause the GPU to stop working for users with an older Nvidia GPU.

What part of this change exactly? No defaults are being set here; it's only explicitly documenting the requirement of setting this option, as introduced in the above PR. The only change will be the error message when this option isn't set

@Kranzes
Copy link
Member

Kranzes commented Sep 5, 2024

I've not been following too closely the history of this module but it seems this change now sets a default value to the open option. I think previously you had to pick a version, but with this change it will just default to open which may break systems with older GPUs.

@kanashimia
Copy link
Member

kanashimia commented Sep 13, 2024

but with this change it will just default to open which may break systems with older GPUs.

No, there is an assertion that tests cfg.open != null

nixos/modules/hardware/video/nvidia.nix Outdated Show resolved Hide resolved
Comment on lines 293 to 300
{
assertion = cfg.open != null;
message = "`hardware.nvidia.open` must be defined when using driver versions >= 560.";
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it here and not where the other assertions are?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the open modules support the datacenter drivers as well, so putting this behind the nvidiaEnabled conditional (which only checks if services.xserver.videoDrivers includes "nvidia") with some of the other assertions could cause this to not work in the event of only hardware.nvidia.datacenter.enable being set

nixos/modules/hardware/video/nvidia.nix Outdated Show resolved Hide resolved
nixos/modules/hardware/video/nvidia.nix Outdated Show resolved Hide resolved
nixos/modules/hardware/video/nvidia.nix Outdated Show resolved Hide resolved
@kanashimia
Copy link
Member

It could also fixed by allowing to define custom message for such options. #338362 improved message, but it is still bad because it isn't custom. @SuperSandro2000
Personally I think assertions are good enough.

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kanashimia
Copy link
Member

Looks good

This requirement was introduced in
NixOS#337289 as a way to make sure users
"explicitly pick which version of the driver they want since nvidia
recommends the open one, but that is incompatible with older drivers".
This is reasonable, however the user isn't informed in any real way
aside from the upcoming release notes

This has caused a
[good](NixOS#337289 (comment))
[amount](NixOS#337289 (comment))
[of](NixOS#338196)
[confusion](NixOS/nixos-hardware#1092) amongst
users. By introducing this assertion and using a new `useOpenModules`
local variable, we can have the same behavior but display a proper error
message to hopefully clear things up until we can safely make this a
default
@getchoo getchoo added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Sep 16, 2024
@wegank wegank added 12.approvals: 2 This PR was reviewed and approved by two reputable people and removed 12.approvals: 1 This PR was reviewed and approved by one reputable person labels Sep 16, 2024
@SuperSandro2000 SuperSandro2000 merged commit b3c4e7f into NixOS:master Sep 17, 2024
25 checks passed
@getchoo getchoo deleted the nixos/nvidia/open-modules branch September 17, 2024 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 1-10 12.approvals: 2 This PR was reviewed and approved by two reputable people
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants