-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
libnvidia-container: include binaries from driver package #372320
libnvidia-container: include binaries from driver package #372320
Conversation
There's really no reason to require the binaries from the nvidia driver package to be passed to libnvidia-container via the PATH. We do the same thing via driverLink for the libraries already, so let's be consistent here.
|
a831dbe
to
07db7b5
Compare
Tested this to work, also in conjunction with #372148 |
NixOS@24d9b8a introduced a bug, that, if `PATH` was actually set to a value when libnvidia-container was ran, caused a segfault. This fixes this bug by scrapping the dynamic `PATH` behavior in favor of simply using the driver package's `driverLink` abstraction for that, which is more fit for the purpose than `PATH` either way.
07db7b5
to
6e4ca5c
Compare
+ // TODO: Remove this patch once `virtualisation.docker.enableNvidia` is removed from NixOS. | ||
+ // It only exists to maintain compatibility with the old nvidia-docker package. | ||
+ if ((env = "/run/nvidia-docker/bin:/run/nvidia-docker/extras/bin:@driverLink@/bin") == NULL) { | ||
error_setx(err, "environment variable PATH not found"); | ||
return (-1); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you wanted to keep the if
statement for some reason, I'm okay with this being removed entirely.
+ if ((os_path = secure_getenv("PATH")) == NULL) { | ||
+ // TODO: Remove this patch once `virtualisation.docker.enableNvidia` is removed from NixOS. | ||
+ // It only exists to maintain compatibility with the old nvidia-docker package. | ||
+ if ((env = "/run/nvidia-docker/bin:/run/nvidia-docker/extras/bin:@driverLink@/bin") == NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do late-binding for nixos (/run
paths) but not other systems (e.g. via PATH
), and why not just always use the early-bound @driverLink@/bin
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken, /run/nvidia-docker/bin
are remnants of virtualisation.docker.enableNvidia
. This patch goes back to always using that, while adding @driverLink@/bin
. I had added additional support for PATH
before (#366855), but things went south there as I introduced a bug. Looking back at that, I decided to go back to a static path, which I did in this PR.
There's really no reason to require the binaries from the nvidia driver package to be passed to libnvidia-container via the PATH. We do the same thing via driverLink for the libraries already, so let's be consistent here.
This also fixes a segfault in the patch I wrote in #366855, which causes uninitialized memory to be written if binaries are mounted into the container. Thus, I scrap the complicated patch entirely here, going back to just including the binaries from the driver package and not via PATH.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.