-
Notifications
You must be signed in to change notification settings - Fork 248
patchpkg: patch python to use devbox CUDA libs #2296
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
Conversation
7507bdf
to
04f319e
Compare
Automatically patch python to use any `cudaPackages.*` packages that are in devbox.json. This will only work if the CUDA drivers are already installed on the host system. The patching process is: 1. When generating the patch flake, look for the system's `libcuda.so` library (installed by the driver) and copy it into the flake's directory. 2. Nix copies the flake's source directory (and therefore libcuda.so) into the nix store when building it. 3. The flake calls `devbox patch` which adds a `DT_NEEDED` entry to the python binary for `libcuda.so`. It also adds the lib directories of any other `cudaPackages.*` packages that it finds in the environment.
04f319e
to
9c758fd
Compare
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.
LGTM, modulo one question below
@@ -302,6 +322,65 @@ func (d *DerivationBuilder) findRemovedRefs(ctx context.Context, pkg *packageFS) | |||
return refs, nil | |||
} | |||
|
|||
func (d *DerivationBuilder) findCUDA(ctx context.Context, out *packageFS) error { |
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.
Food for future thought: Is there a way to do this in a more plugin-like way? Maybe we allow built in plugins to use go code (or in the future compile plugins as needed).
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.
I like the idea of aligning plugins and patching. This code runs as part of the flake builder (in the nix build sandbox), so plugins would just need something similar.
470e552
to
490bfe5
Compare
Automatically patch python to use any
cudaPackages.*
packages that are in devbox.json. This will only work if the CUDA drivers are already installed on the host system.The patching process is:
libcuda.so
library (installed by the driver) and copy it into the flake’s directory.devbox patch
which adds aDT_NEEDED
entry to the python binary forlibcuda.so
. It also adds the lib directories of any othercudaPackages.*
packages that it finds in the environment.