2022-04-15 01:41:22 +00:00
|
|
|
final: prev: let
|
|
|
|
### Cuda Toolkit
|
|
|
|
|
|
|
|
# Function to build the class cudatoolkit package
|
|
|
|
buildCudaToolkitPackage = final.callPackage ./common.nix;
|
|
|
|
|
|
|
|
# Version info for the classic cudatoolkit packages that contain everything that is in redist.
|
|
|
|
cudatoolkitVersions = final.lib.importTOML ./versions.toml;
|
|
|
|
|
2023-03-08 16:32:21 +00:00
|
|
|
finalVersion = cudatoolkitVersions.${final.cudaVersion};
|
|
|
|
|
|
|
|
# Exposed as cudaPackages.backendStdenv.
|
2023-04-12 12:48:02 +00:00
|
|
|
# This is what nvcc uses as a backend,
|
|
|
|
# and it has to be an officially supported one (e.g. gcc11 for cuda11).
|
|
|
|
#
|
|
|
|
# It, however, propagates current stdenv's libstdc++ to avoid "GLIBCXX_* not found errors"
|
|
|
|
# when linked with other C++ libraries.
|
|
|
|
# E.g. for cudaPackages_11_8 we use gcc11 with gcc12's libstdc++
|
2023-03-08 16:32:21 +00:00
|
|
|
# Cf. https://github.com/NixOS/nixpkgs/pull/218265 for context
|
2023-04-12 12:48:02 +00:00
|
|
|
backendStdenv = final.callPackage ./stdenv.nix {
|
2023-04-29 16:46:19 +00:00
|
|
|
# We use buildPackages (= pkgsBuildHost) because we look for a gcc that
|
|
|
|
# runs on our build platform, and that produces executables for the host
|
|
|
|
# platform (= platform on which we deploy and run the downstream packages).
|
|
|
|
# The target platform of buildPackages.gcc is our host platform, so its
|
|
|
|
# .lib output should be the libstdc++ we want to be writing in the runpaths
|
|
|
|
# Cf. https://github.com/NixOS/nixpkgs/pull/225661#discussion_r1164564576
|
|
|
|
nixpkgsCompatibleLibstdcxx = final.pkgs.buildPackages.gcc.cc.lib;
|
|
|
|
nvccCompatibleCC = final.pkgs.buildPackages."${finalVersion.gcc}".cc;
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
2023-03-08 16:32:21 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
### Add classic cudatoolkit package
|
2023-03-08 16:32:21 +00:00
|
|
|
cudatoolkit =
|
|
|
|
let
|
|
|
|
attrs = builtins.removeAttrs finalVersion [ "gcc" ];
|
|
|
|
attrs' = attrs // { inherit backendStdenv; };
|
|
|
|
in
|
|
|
|
buildCudaToolkitPackage attrs';
|
2022-04-15 01:41:22 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
cudaFlags = final.callPackage ./flags.nix {};
|
|
|
|
|
2023-03-08 16:32:21 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
inherit
|
|
|
|
backendStdenv
|
|
|
|
cudatoolkit
|
|
|
|
cudaFlags;
|
2022-04-15 01:41:22 +00:00
|
|
|
}
|