diff --git a/pkgs/development/cuda-modules/_cuda/db/bootstrap/redist.nix b/pkgs/development/cuda-modules/_cuda/db/bootstrap/redist.nix
index da39b5721cb7..efb9332a7fc4 100644
--- a/pkgs/development/cuda-modules/_cuda/db/bootstrap/redist.nix
+++ b/pkgs/development/cuda-modules/_cuda/db/bootstrap/redist.nix
@@ -9,6 +9,7 @@
```
*/
redistNames = [
+ "cublas"
"cublasdx" # NOTE: MathDx; no manifests are published, so ours are made by hand
"cublasmp"
"cuda"
diff --git a/pkgs/development/cuda-modules/_cuda/manifests/cublas/README.md b/pkgs/development/cuda-modules/_cuda/manifests/cublas/README.md
new file mode 100644
index 000000000000..b212f6480bb0
--- /dev/null
+++ b/pkgs/development/cuda-modules/_cuda/manifests/cublas/README.md
@@ -0,0 +1,5 @@
+# cublas
+
+Link:
+
+Requirements:
diff --git a/pkgs/development/cuda-modules/_cuda/manifests/cublas/redistrib_12.8.5.json b/pkgs/development/cuda-modules/_cuda/manifests/cublas/redistrib_12.8.5.json
new file mode 100644
index 000000000000..d291c3d1db33
--- /dev/null
+++ b/pkgs/development/cuda-modules/_cuda/manifests/cublas/redistrib_12.8.5.json
@@ -0,0 +1,30 @@
+{
+ "release_date": "2026-03-16",
+ "release_label": "12.8.5",
+ "release_product": "cublas",
+ "libcublas": {
+ "name": "CUDA cuBLAS",
+ "license": "cuBLAS library",
+ "license_path": "libcublas/LICENSE.txt",
+ "version": "12.8.5.7",
+ "linux-x86_64": {
+ "cuda12": {
+ "relative_path": "libcublas/linux-x86_64/libcublas-linux-x86_64-12.8.5.7_cuda12-archive.tar.xz",
+ "sha256": "d6eb7101b191c456b41c1e8655b06f85faf514cbef7d9ae6aa3a873afe76c275",
+ "md5": "7da3e42ed166faa1a3bef5935e85cd0e",
+ "size": "949916712"
+ }
+ },
+ "cuda_variant": [
+ "12"
+ ],
+ "linux-sbsa": {
+ "cuda12": {
+ "relative_path": "libcublas/linux-sbsa/libcublas-linux-sbsa-12.8.5.7_cuda12-archive.tar.xz",
+ "sha256": "770d86795f7c16ad3124e6e230da62086f4e4bf6cfe55da2d04a8095e171bc77",
+ "md5": "bd69ebd722adfb2066b5bbba43de0c97",
+ "size": "950508424"
+ }
+ }
+ }
+}
diff --git a/pkgs/development/cuda-modules/_cuda/manifests/cublas/redistrib_13.4.2.json b/pkgs/development/cuda-modules/_cuda/manifests/cublas/redistrib_13.4.2.json
new file mode 100644
index 000000000000..a9349389debf
--- /dev/null
+++ b/pkgs/development/cuda-modules/_cuda/manifests/cublas/redistrib_13.4.2.json
@@ -0,0 +1,30 @@
+{
+ "release_date": "2026-09-14",
+ "release_label": "13.4.2",
+ "release_product": "cublas",
+ "libcublas": {
+ "name": "CUDA cuBLAS",
+ "license": "cuBLAS library",
+ "license_path": "libcublas/LICENSE.txt",
+ "version": "13.4.2.4",
+ "linux-x86_64": {
+ "cuda13": {
+ "relative_path": "libcublas/linux-x86_64/libcublas-linux-x86_64-13.4.2.4_cuda13-archive.tar.xz",
+ "sha256": "3c5a8468991b97630fe29bd04f9a781f69aef4f376d4cbfe90217b0203edf287",
+ "md5": "e60a359a526db09e63e9ea6617093f47",
+ "size": "807967936"
+ }
+ },
+ "cuda_variant": [
+ "13"
+ ],
+ "linux-sbsa": {
+ "cuda13": {
+ "relative_path": "libcublas/linux-sbsa/libcublas-linux-sbsa-13.4.2.4_cuda13-archive.tar.xz",
+ "sha256": "1dba1433fc7a7aee714e0ebf4e1737a175a6341225b7352da07c15419ebefe8e",
+ "md5": "3229659314ae6d7b0c48cfd1d3f7015f",
+ "size": "1021627464"
+ }
+ }
+ }
+}
diff --git a/pkgs/development/cuda-modules/_cuda/manifests/cublas/redistrib_13.6.2.json b/pkgs/development/cuda-modules/_cuda/manifests/cublas/redistrib_13.6.2.json
new file mode 100644
index 000000000000..0f2188244cb0
--- /dev/null
+++ b/pkgs/development/cuda-modules/_cuda/manifests/cublas/redistrib_13.6.2.json
@@ -0,0 +1,30 @@
+{
+ "release_date": "2026-09-08",
+ "release_label": "13.6.2",
+ "release_product": "cublas",
+ "libcublas": {
+ "name": "CUDA cuBLAS",
+ "license": "cuBLAS library",
+ "license_path": "libcublas/LICENSE.txt",
+ "version": "13.6.2.16",
+ "linux-x86_64": {
+ "cuda13": {
+ "relative_path": "libcublas/linux-x86_64/libcublas-linux-x86_64-13.6.2.16_cuda13-archive.tar.xz",
+ "sha256": "ba1b298674da2c1c850fcc0722108a100ad5f5dacfbcaf4b58d0633b5a4c66c6",
+ "md5": "9463efbb3fed6416fb77fa8a3f20834d",
+ "size": "817853184"
+ }
+ },
+ "cuda_variant": [
+ "13"
+ ],
+ "linux-sbsa": {
+ "cuda13": {
+ "relative_path": "libcublas/linux-sbsa/libcublas-linux-sbsa-13.6.2.16_cuda13-archive.tar.xz",
+ "sha256": "950f5d4ce75c26ff34b3c9d4157b30ab3fd4b06018d139c2868f8226b287dfdc",
+ "md5": "964a4400bd977017937409488e255b45",
+ "size": "1031550256"
+ }
+ }
+ }
+}
diff --git a/pkgs/development/cuda-modules/_cuda/manifests/cublas/redistrib_13.8.2.json b/pkgs/development/cuda-modules/_cuda/manifests/cublas/redistrib_13.8.2.json
new file mode 100644
index 000000000000..6a4c0d4be32d
--- /dev/null
+++ b/pkgs/development/cuda-modules/_cuda/manifests/cublas/redistrib_13.8.2.json
@@ -0,0 +1,30 @@
+{
+ "release_date": "2026-10-26",
+ "release_label": "13.8.2",
+ "release_product": "cublas",
+ "libcublas": {
+ "name": "CUDA cuBLAS",
+ "license": "cuBLAS library",
+ "license_path": "libcublas/LICENSE.txt",
+ "version": "13.8.2.12",
+ "linux-x86_64": {
+ "cuda13": {
+ "relative_path": "libcublas/linux-x86_64/libcublas-linux-x86_64-13.8.2.12_cuda13-archive.tar.xz",
+ "sha256": "b54be9d26b05e97a27e248c9d82f8fa5dfe72fcef6c41a3a4a834332cf01b689",
+ "md5": "7448ece1297e14222609875324ae6a8a",
+ "size": "877509868"
+ }
+ },
+ "cuda_variant": [
+ "13"
+ ],
+ "linux-sbsa": {
+ "cuda13": {
+ "relative_path": "libcublas/linux-sbsa/libcublas-linux-sbsa-13.8.2.12_cuda13-archive.tar.xz",
+ "sha256": "26b32cfadd7025147c9a3f55755c9b401f84ed817c4856c44b6c1ba2afb7b648",
+ "md5": "9343ff7e9eca81cd91eea24bd7951a6e",
+ "size": "1101175684"
+ }
+ }
+ }
+}
diff --git a/pkgs/development/cuda-modules/packages/libcublas.nix b/pkgs/development/cuda-modules/packages/libcublas.nix
index 1c774b529104..af6a7d6697b5 100644
--- a/pkgs/development/cuda-modules/packages/libcublas.nix
+++ b/pkgs/development/cuda-modules/packages/libcublas.nix
@@ -1,10 +1,30 @@
{
+ backendStdenv,
buildRedist,
cuda_nvrtc,
+ cudaMajorMinorVersion,
lib,
+ manifests,
}:
+let
+ cudaCublasVersion = manifests.cuda.libcublas.version;
+ standaloneVersion = manifests.cublas.libcublas.version;
+
+ # Package sets may select a standalone cuBLAS release, which must be a newer patch release of the cuBLAS shipped with
+ # CUDA. Use it when it has a build for the host.
+ isStandalone =
+ manifests ? cublas
+ &&
+ lib.assertMsg
+ (
+ lib.versions.majorMinor standaloneVersion == lib.versions.majorMinor cudaCublasVersion
+ && lib.versionOlder cudaCublasVersion standaloneVersion
+ )
+ "libcublas: standalone cuBLAS ${standaloneVersion} is not a newer patch release of CUDA's cuBLAS ${cudaCublasVersion}; drop or update the cublas pin"
+ && manifests.cublas.libcublas ? ${backendStdenv.hostRedistSystem};
+in
buildRedist (finalAttrs: {
- redistName = "cuda";
+ redistName = if isStandalone then "cublas" else "cuda";
pname = "libcublas";
# libcublasLt dlopens NVRTC to compile kernels at runtime; absent before 12.8.
@@ -21,11 +41,48 @@ buildRedist (finalAttrs: {
"stubs"
];
+ # Standalone archives lack the stubs and pkg-config file shipped with CUDA's cuBLAS, so generate them. Like NVIDIA's,
+ # the stubs define the libraries' versioned functions, each of which prints a warning.
+ ${if isStandalone then "postUnpack" else null} = ''
+ mkdir "$sourceRoot/lib/stubs"
+ for base in cublas cublasLt; do
+ real="$sourceRoot/lib/lib$base.so"
+ stub="$sourceRoot/lib/stubs/lib$base.so"
+ nixLog "generating $stub"
+ $NM --dynamic --defined-only --format=posix "$real" | awk -v base="$base" '
+ BEGIN { print "#include " > base ".c" }
+ $2 == "T" {
+ split($1, sym, "@@")
+ print "int " sym[1] "(void) { return puts(\"You are running using the stub version of " base "\"); }" > base ".c"
+ syms[sym[2]] = syms[sym[2]] " " sym[1] ";"
+ }
+ END { for (ver in syms) print ver " { global:" syms[ver] " local: *; };" > base ".map" }
+ '
+ $CC -shared -fPIC -o "$stub" "$base.c" -Wl,--version-script="$base.map" \
+ -Wl,-soname,"$($READELF --dynamic "$real" | sed -n 's/.*(SONAME).*\[\(.*\)\]$/\1/p')"
+ diff <($NM --dynamic --defined-only "$real" | cut -d' ' -f2-) <($NM --dynamic --defined-only "$stub" | cut -d' ' -f2-)
+ done
+
+ mkdir "$sourceRoot/pkg-config"
+ cat >"$sourceRoot/pkg-config/cublas-${cudaMajorMinorVersion}.pc" <<'EOF'
+ cudaroot=/usr/local/cuda-${cudaMajorMinorVersion}
+ libdir=''${cudaroot}/lib
+ includedir=''${cudaroot}/include
+
+ Name: cublas
+ Description: CUDA Basic Linear Algebra Subprograms
+ Version: ${cudaMajorMinorVersion}
+ Libs: -L''${libdir} -lcublas
+ Cflags: -I''${includedir}
+ EOF
+ '';
+
meta = {
description = "CUDA Basic Linear Algebra Subroutine library";
longDescription = ''
The cuBLAS library is an implementation of BLAS (Basic Linear Algebra Subprograms) on top of the NVIDIA CUDA runtime.
'';
homepage = "https://developer.nvidia.com/cublas";
+ license = lib.licenses.nvidiaCudaRedist;
};
})
diff --git a/pkgs/top-level/cuda-packages.nix b/pkgs/top-level/cuda-packages.nix
index 83b4a63c1236..4ce124770aab 100644
--- a/pkgs/top-level/cuda-packages.nix
+++ b/pkgs/top-level/cuda-packages.nix
@@ -33,6 +33,14 @@ let
# - TensorRT 11.x has no linux-sbsa build for CUDA 12 and dropped JetPack support with 11.2.1, so Jetson devices use
# TensorRT 10.x with CUDA 12 and CUDA 13.0 and 13.1, and TensorRT 11.1.0 (which supports Orin and Thor with
# CUDA 13.2 and later) with CUDA 13.2 and later.
+ # - cublas: a package set selects a standalone release only when it is a newer patch release of the cuBLAS shipped
+ # with its CUDA release (same major and minor version); evaluation fails otherwise, so drop or update the pin when
+ # updating CUDA. libcublas uses it on every platform with a build: standalone releases have no linux-aarch64
+ # (pre-Thor Jetson) builds, so those use CUDA's. As of writing:
+ # - CUDA 12.8 (cuBLAS 12.8.5.5), 13.2 (13.4.1.3), 13.3 (13.6.0.2), and 13.4 (13.8.0.4): standalone 12.8.5.7,
+ # 13.4.2.4, 13.6.2.16, and 13.8.2.12.
+ # - CUDA 12.6, 12.9, 13.0, and 13.1: no newer standalone release (12.9.2.7 and 13.1.1.2 are older than CUDA's
+ # 12.9.2.10 and 13.1.1.3; 13.2.2.2 is the same as CUDA 13.1's).
# - cublasdx (MathDx): 25.06.1 is the last release for CUDA 12, and 26.x requires CUDA 13.
# - cudnn:
# - NVIDIA dropped linux-aarch64 (pre-Thor Jetson) support for CUDA 12 after 9.20.0, so we keep 9.20.0 for Jetson with
@@ -68,6 +76,7 @@ let
};
cudaPackages_12_8 = mkCudaPackages {
+ cublas = "12.8.5";
cublasdx = "25.06.1";
cublasmp = "0.10.0";
cuda = "12.8.2";
@@ -152,6 +161,7 @@ let
};
cudaPackages_13_2 = mkCudaPackages {
+ cublas = "13.4.2";
cublasdx = "26.06.1";
cublasmp = "0.10.0";
cuda = "13.2.2";
@@ -170,6 +180,7 @@ let
};
cudaPackages_13_3 = mkCudaPackages {
+ cublas = "13.6.2";
cublasdx = "26.06.1";
cublasmp = "0.10.0";
cuda = "13.3.1";
@@ -188,6 +199,7 @@ let
};
cudaPackages_13_4 = mkCudaPackages {
+ cublas = "13.8.2";
cublasdx = "26.06.1";
cublasmp = "0.10.0";
cuda = "13.4.3";