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

nvidia-container-toolkit: add suppressNvidiaDriverAssertion option #362197

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Atry
Copy link
Contributor

@Atry Atry commented Dec 5, 2024

The assertion to ensure the Nvidia driver does not make sense on WSL, where the Nvidia driver is mounted by Windows. See https://github.com/nix-community/NixOS-WSL/blob/a6b9cf0b7805e2c50829020a73e7bde683fd36dd/modules/wsl-distro.nix#L83-L105

This PR adds an option to suppress the assertion so that nvidia-container-toolkit works on WSL.

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/)
  • 25.05 Release Notes (or backporting 24.11 and 25.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/` 6.topic: nvidia labels Dec 5, 2024
@Atry Atry requested a review from ereslibre December 5, 2024 20:47
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Dec 5, 2024
Copy link
Member

@ereslibre ereslibre left a comment

Choose a reason for hiding this comment

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

Thank you! LGTM

@ereslibre
Copy link
Member

/cc @SomeoneSerge

@ereslibre ereslibre added 12.approvals: 1 This PR was reviewed and approved by one reputable person 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package backport release-24.11 Backport PR automatically labels Dec 6, 2024
@Atry Atry marked this pull request as ready for review December 8, 2024 20:33
@wegank wegank removed the 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package label Dec 8, 2024
@@ -37,6 +37,15 @@
'';
};

noNvidiaDriverAssertion = lib.mkOption {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe something more specific like useExternalNvidiaDriver or so?

Copy link
Member

Choose a reason for hiding this comment

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

I don’t have a very strong position on this. I think noNvidiaDriverAssertion is more explicit to what it does. useExternalNvidiaDriver might signal that there’s some kind of logic to handle that case IMO.

Copy link
Contributor

Choose a reason for hiding this comment

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

No strong opinion either, certainly not blocking.

Copy link
Contributor

Choose a reason for hiding this comment

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

Regarding the current name, there already is nvidia in hardware.nvidia-container-toolkit so you can reduce this noDriverAssertion. Some people also say that verbs work better than nouns, and that active voice is better than passive which would suggest something like disableDriverAssertion, disableDriverCheck. But also there's no need to have a negation in the name, so you could have checkDriver with default = false (just an mkEnableOption). The less specific name is of little concern because we should include the option name in the assertion's message anyway

@wolfgangwalther makes me think along the lines of replacing the hardware.nvidia.package option with a hardware.nvidia.driver = mkOption { ...; type = oneOf [ package (enum [ "WSL" ]) ], so that the computed locations would special-case for WSL and use the /usr/...` path. Might be over-engineering though

Copy link
Contributor Author

@Atry Atry Jan 2, 2025

Choose a reason for hiding this comment

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

How about suppressNvidiaDriverAssertion? The name would imply that the assertion is enabled by default and the option can suppress the assertion. I think it's clearer than a mkEnableOption whose default value is true.

Copy link
Contributor

Choose a reason for hiding this comment

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

checkDriver with default = false (just an mkEnableOption)

Oh sorry I just got lost in words, that would need to have been checkDriver = mkEnableOption ... // { default = true; }

How about suppressNvidiaDriverAssertion?

I'd still make the argument about omitting "Nvidia". As for suppress/disable/enable/do/dont/etc. I've no strong opinion

@wegank wegank removed the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Dec 16, 2024
Copy link
Contributor

@SomeoneSerge SomeoneSerge left a comment

Choose a reason for hiding this comment

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

Sorry for ignoring the ping earlier. The comments above aren't blocking, so I'll wait a few days in case you're around to update the PR, and then I'll merge it regardless because the names and messages can be changed later

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Jan 2, 2025
@Atry Atry changed the title nvidia-container-toolkit: add noNvidiaDriverAssertion option nvidia-container-toolkit: add suppressNvidiaDriverAssertion option Jan 2, 2025
@wegank wegank removed the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Jan 2, 2025
@Atry Atry requested a review from SuperSandro2000 January 2, 2025 21:20
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 6.topic: nvidia 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 on Darwin 10.rebuild-linux: 1-10 backport release-24.11 Backport PR automatically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants