From 06abe3f50e0ef33234a11bfdbb286f2f2c3078f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Tue, 4 Feb 2025 10:24:33 +0000 Subject: [PATCH] impureWithCuda: fix gcc version --- nix/impure-shell.nix | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/nix/impure-shell.nix b/nix/impure-shell.nix index a13fd711..aebdff84 100644 --- a/nix/impure-shell.nix +++ b/nix/impure-shell.nix @@ -94,8 +94,18 @@ mkShell { ( cd clients/python ; python -m pip install --no-dependencies -e . ) ''; - postShellHook = '' - unset SOURCE_DATE_EPOCH - export PATH=$PATH:~/.cargo/bin - ''; + postShellHook = + '' + unset SOURCE_DATE_EPOCH + export PATH=${cudaPackages.backendStdenv.cc}/bin:$PATH:~/.cargo/bin + '' + # At various points in time, the latest gcc supported by CUDA differs + # from the default version in nixpkgs. A lot of the dependencies in + # the impure environment pull in the default gcc from nixpkgs, so we + # end up with the CUDA-supported gcc and the nixpkgs default gcc in + # the path. To ensure that we can build CUDA kernels, put the CUDA + # first in the path. It's a hack, but it works. + + lib.optionalString withCuda '' + export PATH=${cudaPackages.backendStdenv.cc}/bin:$PATH + ''; }