Change:
is only ever built with the default version of because the line which adds the derivation never changes the version of provided: I confirmed this by making this change to the derivation and trying to build it with two different versions of . Notice that the error is the same: <details</detailsIn the pattern seems to be passing . However, it is relatively rare that the derivation takes as an argument. Instead, it seems to be preferred to have the derivation take, as arguments, the actual python packages required. To bring the NCCL derivation in line with this pattern, it should take the CUDA packages it requires as arguments. <!-- Please @ people who are in the list of the offending package or module. If in doubt, check for whoever last touched something. --
We only expose nccl as . Let's change it to take cudaPackages' individual attributes as arguments, so that works properly. Nccl already uses solely the redist packages, so I guess we needn't worry about cuda10
Agreed -- WIP at Running a now :)
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
Well, since gh pushed a notification anyway: that's one long nixpkgs-review:)

Discussion:
, backendStdenv , fetchFromGitHub , which <del> , cudaPackages ? { } , addOpenGLRunpath </del> <ins> , autoAddOpenGLRunpathHook , cuda_cccl , cuda_cudart , cuda_nvcc , cudaFlags , cudaVersion </ins> }: <del> with cudaPackages; </del> let # Output looks like "-gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_86,code=compute_86" gencode = lib.concatStringsSep " " cudaFlags.gencode; in <del> backendStdenv.mkDerivation rec { name = "nccl-${version}-cuda-${cudaPackages.cudaMajorVersion}"; </del> <ins> backendStdenv.mkDerivation (finalAttrs: { name = "nccl-${finalAttrs.version}-cuda-${cudaVersion}"; </ins> version = "2.16.5-1"; src = fetchFromGitHub { owner = "NVIDIA"; repo = "nccl"; <del> rev = "v${version}"; </del> <ins> rev = "v${finalAttrs.version}"; </ins> hash = "sha256-JyhhYKSVIqUKIbC1rCJozPT1IrIyRLGrTjdPjJqsYaU="; };

nativeBuildInputs = [ which <del> addOpenGLRunpath </del> <ins> autoAddOpenGLRunpathHook </ins> cuda_nvcc ]; buildInputs = [ cuda_cudart <del> ] ++ lib.optionals (lib.versionAtLeast cudaVersion "12.0.0") [ </del> <ins> ] # NOTE: CUDA versions in Nixpkgs only use a major and minor version. When we do comparisons # against other version, like below, it's important that we use the same format. Otherwise, # we'll get incorrect results. # For example, lib.versionAtLeast "12.0" "12.0.0" == false. ++ lib.optionals (lib.versionAtLeast cudaVersion "12.0") [ </ins> cuda_cccl ];

makeFlags = [ "CUDA_HOME=${cuda_nvcc}" <del> "CUDA_LIB=${cuda_cudart}/lib64" "CUDA_INC=${cuda_cudart}/include" </del> <ins> "CUDA_LIB=${lib.getLib cuda_cudart}/lib" "CUDA_INC=${lib.getDev cuda_cudart}/include" </ins> "PREFIX=$(out)" ]; postFixup = '' moveToOutput lib/libnccl_static.a $dev <del> # Set RUNPATH so that libnvidia-ml in /run/opengl-driver(-32)/lib can be found. # See the explanation in addOpenGLRunpath. addOpenGLRunpath $out/lib/lib*.so </del> ''; env.NIX_CFLAGS_COMPILE = toString [ "-Wno-unused-function" ]; enableParallelBuilding = true; <del> passthru = { inherit cudaPackages; }; </del> meta = with lib; { description = "Multi-GPU and multi-node collective communication primitives for NVIDIA GPUs"; homepage = "https://developer.nvidia.com/nccl";

platforms = [ "x86_64-linux" ]; maintainers = with maintainers; [ mdaiter orivej ]; }; <del> } </del> <ins> }) </ins>