python3Packages.lightgbm: override stdenv if built with cuda support

From https://github.com/NixOS/nixpkgs/pull/507972#discussion_r3053161889:

> [This prevents] the other stdenv and its cc from leaking into the
> build. The latter is somewhat optional, but the leakage can result in,
> on one hand, in mixing object files from different cc releases ("works
> in practice but nobody offers guarantees"), and on the other in the
> hypothetical possibility that cuda tools use up wrong cc.
>
> If lightgbm builds cuda kernel, it "should" conditionally override
> stdenv, so far we don't have a better system to configure this
> transparently to individual packages...
This commit is contained in:
Florian Klink
2026-04-09 23:47:47 +01:00
parent 2fa06e7751
commit 23c177448c
@@ -42,7 +42,10 @@
assert gpuSupport -> !cudaSupport;
assert cudaSupport -> !gpuSupport;
buildPythonPackage (finalAttrs: {
let
effectiveStdenv = if cudaSupport then cudaPackages.backendStdenv else stdenv;
in
buildPythonPackage.override { stdenv = effectiveStdenv; } (finalAttrs: {
inherit (pkgs.lightgbm)
pname
version