Commit 23c17744 authored by Florian Klink's avatar Florian Klink
Browse files

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...
parent 2fa06e77
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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