diff --git a/nongnu/packages/nvidia.scm b/nongnu/packages/nvidia.scm index 5f03b8a..7759686 100644 --- a/nongnu/packages/nvidia.scm +++ b/nongnu/packages/nvidia.scm @@ -45,10 +45,12 @@ #:use-module (gnu packages gtk) #:use-module (gnu packages linux) #:use-module (gnu packages m4) + #:use-module (gnu packages ncurses) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) #:use-module (gnu packages video) + #:use-module (gnu packages xml) #:use-module (gnu packages xorg) #:use-module (nongnu packages linux) #:use-module (ice-9 match) @@ -64,6 +66,65 @@ ; Used for the open-source kernel module package (define nversion "515.57") +(define (make-cuda version origin) + (package + (name "cuda-toolkit") + (version version) + (source origin) + (build-system gnu-build-system) + (arguments + `(#:phases (modify-phases %standard-phases + (replace 'unpack + (lambda* (#:key inputs #:allow-other-keys) + (let* ((source (assoc-ref inputs "source"))) + (invoke "sh" source "--keep" "--noexec") + (chdir "pkg")))) + (delete 'configure) + (delete 'check) + (replace 'build + (let* ((cuda "cuda-installer") + (rpath (string-append (apply string-append (map + (lambda (pkg) + (string-append (assoc-ref inputs pkg) "/lib:")) + '("gcc" + "glib" + "libxml2" + "ncurses"))))) + (ld-so (string-append (assoc-ref inputs "libc") + ,(glibc-dynamic-linker)))) + (invoke "patchelf" "--set-rpath" rpath cuda) + (invoke "patchelf" "--set-interpreter" ld-so cuda) + (invoke "sh" cuda "--keep" "--noexec")))))) + (native-inputs + (list `(,gcc "lib"))) + glib + libxml2 + ncurses + patchelf + perl + python-2 + which)) + (synopsis + "Compiler for the CUDA language and associated run-time support") + (description + "This package provides the CUDA compiler and the CUDA run-time support +libraries for NVIDIA GPUs, all of which are proprietary.") + (home-page "https://developer.nvidia.com/cuda-toolkit") + (license #f) + (supported-systems '("x86_64-linux")))) + +(define-syntax-rule (cuda-source url hash) + (origin + (uri url) + (sha256 (base32 hash)) + (method url-fetch))) + +(define-public cuda-11.5.1 + (make-cuda "11.5.1" + (cuda-source + "https://developer.download.nvidia.com/compute/cuda/11.5.1/local_installers/cuda_11.5.1_495.29.05_linux.run" + "1jjb39qr5cjjy3sm8mf8q8p456gmzdd3argq2m05g5dc1zya5gk0"))) + (define-public nvidia-driver (package (name "nvidia-driver")