From 47941b0a84e4148bc778e4854fd6bfb38fa9928c Mon Sep 17 00:00:00 2001 From: Hilton Chain Date: Thu, 1 Feb 2024 18:39:27 +0800 Subject: [PATCH] nongnu: nvidia: Re-order variables. * nongnu/packages/nvidia.scm: Remove unused modules. Add comments to group NVIDIA driver packages. Sort other packages alphabetically. Signed-off-by: John Kehayias --- nongnu/packages/nvidia.scm | 528 ++++++++++++++++++++----------------- 1 file changed, 280 insertions(+), 248 deletions(-) diff --git a/nongnu/packages/nvidia.scm b/nongnu/packages/nvidia.scm index f75d0d4..d1aaffd 100644 --- a/nongnu/packages/nvidia.scm +++ b/nongnu/packages/nvidia.scm @@ -38,25 +38,16 @@ #:use-module (gnu packages linux) #:use-module (gnu packages m4) #:use-module (gnu packages lsof) - #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) - #:use-module (gnu packages python) #:use-module (gnu packages python-xyz) - #:use-module (gnu packages python-web) #:use-module (gnu packages qt) - #:use-module (gnu packages terminals) #:use-module (gnu packages video) #:use-module (gnu packages web) #:use-module (gnu packages xdisorg) #:use-module (gnu packages xml) #:use-module (gnu packages xorg) #:use-module (nongnu packages linux) - #:use-module (ice-9 match) - #:use-module (ice-9 regex) - #:use-module (ice-9 format) - #:use-module (ice-9 textual-ports) - #:use-module (ice-9 match) - #:use-module (srfi srfi-1)) + #:use-module (ice-9 match)) (define-public %nvidia-environment-variable-regexps '("^__GL_" ; NVIDIA OpenGL settings. @@ -73,11 +64,17 @@ ;; GSYNC control for Vulkan direct-to-display applications. "^VKDirectGSYNC(Compatible)?Allowed$")) -(define nvidia-version "515.76") +(define-public nvidia-version "515.76") (define computed-origin-method (@@ (guix packages) computed-origin-method)) + +;;; +;;; NVIDIA driver checkouts +;;; + + ;; Extract the driver installer and make it a new origin instance for reusing. (define (make-nvidia-source version installer) (origin @@ -107,7 +104,7 @@ (not (member file '("." "..")))))) #$output))))))) -(define nvidia-source +(define-public nvidia-source (let ((version nvidia-version)) (make-nvidia-source version @@ -119,110 +116,11 @@ (sha256 (base32 "0i5zyvlsjnfkpfqhw6pklp0ws8nndyiwxrg4pj04jpwnxf6a38n6")))))) -(define-public gpustat - (package - (name "gpustat") - (version "1.0.0") - (source (origin - (method url-fetch) - (uri (pypi-uri "gpustat" version)) - (sha256 - (base32 - "1wg3yikkqdrcxp5xscyb9rxifgfwv7qh73xv4airab63b3w8y7jq")))) - (build-system python-build-system) - (arguments - '(#:tests? #f)) - (propagated-inputs (list python-blessed python-nvidia-ml-py python-psutil - python-six)) - (native-inputs (list python-mock python-pytest python-pytest-runner)) - (home-page "https://github.com/wookayin/gpustat") - (synopsis "Utility to monitor NVIDIA GPU status and usage") - (description - "This package provides an utility to monitor NVIDIA GPU status -and usage.") - (license license-gnu:expat))) + +;;; +;;; NVIDIA drivers +;;; -(define-public python-nvidia-ml-py - (package - (name "python-nvidia-ml-py") - (version "11.495.46") - (source (origin - (method url-fetch) - (uri (pypi-uri "nvidia-ml-py" version)) - (sha256 - (base32 - "09cnb7xasd7brby52j70y7fqsfm9n6gvgqf769v0cmj74ypy2s4g")))) - (build-system python-build-system) - (arguments - (list #:phases #~(modify-phases %standard-phases - (add-after 'unpack 'fix-libnvidia - (lambda _ - (substitute* "pynvml.py" - (("libnvidia-ml.so.1") - (string-append #$(this-package-input - "nvidia-driver") - "/lib/libnvidia-ml.so.1")))))))) - (inputs (list nvidia-driver)) - (home-page "https://forums.developer.nvidia.com") - (synopsis "Python Bindings for the NVIDIA Management Library") - (description "This package provides official Python Bindings for the NVIDIA -Management Library") - (license license-gnu:bsd-3))) - -(define-public nvidia-htop - (package - (name "nvidia-htop") - (version "1.0.5") - (source (origin - (method url-fetch) - (uri (pypi-uri "nvidia-htop" version)) - (sha256 - (base32 - "0lv9cpccpkbg0d577irm1lp9rx6pacyk2pk9v41k9s9hyl4b7hvx")))) - (build-system python-build-system) - (arguments - (list #:phases #~(modify-phases %standard-phases - (add-after 'unpack 'fix-libnvidia - (lambda _ - (substitute* "nvidia-htop.py" - (("nvidia-smi") - (string-append #$(this-package-input - "nvidia-driver") - "/bin/nvidia-smi")))))))) - (inputs (list nvidia-driver)) - (propagated-inputs (list python-termcolor)) - (home-page "https://github.com/peci1/nvidia-htop") - (synopsis "Tool to enrich the output of nvidia-smi") - (description "This package provides tool for enriching the output of -nvidia-smi.") - (license license-gnu:bsd-3))) - -(define-public python-py3nvml - (package - (name "python-py3nvml") - (version "0.2.7") - (source (origin - (method url-fetch) - (uri (pypi-uri "py3nvml" version)) - (sha256 - (base32 - "0wxxky9amy38q7qjsdmmznk1kqdzwd680ps64i76cvlab421vvh9")))) - (build-system python-build-system) - (arguments - (list #:phases #~(modify-phases %standard-phases - (add-after 'unpack 'fix-libnvidia - (lambda _ - (substitute* "py3nvml/py3nvml.py" - (("libnvidia-ml.so.1") - (string-append #$(this-package-input - "nvidia-driver") - "/lib/libnvidia-ml.so.1")))))))) - (propagated-inputs (list nvidia-driver python-xmltodict)) - (home-page "https://github.com/fbcotter/py3nvml") - (synopsis "Unoffcial Python 3 Bindings for the NVIDIA Management Library") - (description "This package provides unofficial Python 3 Bindings for the -NVIDIA Management Library") - (license license-gnu:bsd-3))) (define-public nvidia-driver (package @@ -327,12 +225,12 @@ KERNEL==\"nvidia_uvm\", RUN+=\"@sh@ -c '@mknod@ -m 666 /dev/nvidia-uvm-tools c $ (add-after 'patch-elf 'create-short-name-symlinks (lambda _ (define (get-soname file) - (when elf-file? file - (let* ((cmd (string-append "patchelf --print-soname " file)) - (port (open-input-pipe cmd)) - (soname (read-line port))) - (close-pipe port) - soname))) + (when (elf-file? file) + (let* ((cmd (string-append "patchelf --print-soname " file)) + (port (open-input-pipe cmd)) + (soname (read-line port))) + (close-pipe port) + soname))) (for-each (lambda (lib) @@ -392,6 +290,15 @@ configured by adding: @code{(modules (cons* nvidia-driver (license:nonfree (format #f "file:///share/doc/nvidia-driver-~a/LICENSE" version))))) +(define-public nvidia-libs + (deprecated-package "nvidia-libs" nvidia-driver)) + + +;;; +;;; NVIDIA frimwares +;;; + + (define-public nvidia-firmware (let ((base nvidia-driver)) (package @@ -405,92 +312,13 @@ configured by adding: @code{(modules (cons* nvidia-driver #~(modify-phases %standard-phases (delete 'strip)))) (inputs '()) - (native-inputs '()) - (properties `((hidden? . #t)))))) + (native-inputs '())))) -(define-public nvidia-exec - (package - (name "nvidia-exec") - (version "0.1.0") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/pedro00dk/nvidia-exec") - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "079alqgz3drv5mvx059fzhj3f20rnljl7r4yihfd5qq7djgmvv0v")))) - (build-system copy-build-system) - (arguments - (list #:install-plan #~`(("nvx" "bin/")) - #:modules #~((guix build copy-build-system) - (guix build utils) - (srfi srfi-1)) - #:phases #~(modify-phases %standard-phases - (add-after 'install 'wrap-nvx - (lambda* (#:key inputs outputs #:allow-other-keys) - (wrap-program (string-append #$output "/bin/nvx") - `("PATH" ":" prefix - ,(fold (lambda (input paths) - (let* ((in (assoc-ref - inputs input)) - (bin (string-append - in "/bin"))) - (append (filter - file-exists? - (list bin)) - paths))) - '() - '("jq" "lshw" "lsof"))))))))) - (inputs (list bash-minimal jq lshw lsof)) - (home-page "https://github.com/pedro00dk/nvidia-exec") - (synopsis "GPU switching without login out for Nvidia Optimus laptops") - (description - "This package provides GPU switching without login out for Nvidia Optimus -laptops.") - (license license-gnu:gpl3+))) + +;;; +;;; NVIDIA kernel modules +;;; -(define-public nvidia-nvml - (package - (name "nvidia-nvml") - (version "352.79") - (source - (origin - (method url-fetch) - (uri (string-append "https://developer.download.nvidia.com/compute/cuda/7.5/Prod/gdk/" - (format #f "gdk_linux_amd64_~a_release.run" - (string-replace-substring version "." "_")))) - (sha256 - (base32 - "1r2cwm0j9svaasky3qw46cpg2q6rrazwzrc880nxh6bismyd3a9z")) - (file-name (string-append "nvidia-nvml-" version "-checkout")))) - (build-system copy-build-system) - (arguments - (list #:phases - #~(modify-phases %standard-phases - (replace 'unpack - (lambda _ - (invoke "sh" #$source "--tar" "xvf")))) - #:install-plan - ''(("payload/nvml/lib" "lib") - ("payload/nvml/include" "include/nvidia/gdk") - ("payload/nvml/example" "src/gdk/nvml/examples") - ("payload/nvml/doc/man" "share/man") - ("payload/nvml/README.txt" "README.txt") - ("payload/nvml/COPYRIGHT.txt" "COPYRIGHT.txt")))) - (home-page "https://www.nvidia.com") - (synopsis "The NVIDIA Management Library (NVML)") - (description "C-based programmatic interface for monitoring and managing various -states within NVIDIA Tesla GPUs. It is intended to be a platform for -building 3rd party applications, and is also the underlying library for the -NVIDIA-supported nvidia-smi tool. NVML is thread-safe so it is safe to make -simultaneous NVML calls from multiple threads.") - ;; Doesn't have any specific LICENSE file, but see COPYRIGHT.txt for details. - (license (license:nonfree "file://COPYRIGHT.txt")))) - -(define-public nvidia-libs - (deprecated-package "nvidia-libs" nvidia-driver)) (define-public nvidia-module (package @@ -552,6 +380,12 @@ require firmware file @code{gsp.bin} to be loaded as well as closed source userspace tools from the corresponding driver release.") (license license-gnu:gpl2)))) + +;;; +;;; ‘nvidia-settings’ packages +;;; + + (define-public nvidia-settings (package (name "nvidia-settings") @@ -578,8 +412,8 @@ userspace tools from the corresponding driver release.") (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (wrap-program (string-append out "/bin/nvidia-settings") - `("LD_LIBRARY_PATH" ":" prefix - (,(string-append out "/lib/")))))))))) + `("LD_LIBRARY_PATH" ":" prefix + (,(string-append out "/lib/")))))))))) (native-inputs (list m4 pkg-config)) (inputs (list bash-minimal @@ -600,47 +434,11 @@ configuration, creating application profiles, gpu monitoring and more.") (home-page "https://github.com/NVIDIA/nvidia-settings") (license license-gnu:gpl2))) -(define-public nvidia-system-monitor - (package - (name "nvidia-system-monitor") - (version "1.5") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/congard/nvidia-system-monitor-qt") - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "0aghdqljvjmc02g9jpc7sb3yhha738ywny51riska56hkxd3jg2l")))) - (build-system cmake-build-system) - (arguments - (list #:tests? #f - #:phases #~(modify-phases %standard-phases - (add-after 'unpack 'fix-nvidia-smi - (lambda _ - (let ((nvidia-smi (string-append #$(this-package-input - "nvidia-driver") - "/bin/nvidia-smi"))) - (substitute* "src/core/InfoProvider.cpp" - (("nvidia-smi") - nvidia-smi)) - (substitute* "src/main.cpp" - (("which nvidia-smi") - (string-append "which " nvidia-smi)) - (("exec..nvidia-smi") - (string-append "exec(\"" nvidia-smi)))))) - (replace 'install - (lambda* (#:key outputs #:allow-other-keys) - (let ((bin (string-append #$output "/bin"))) - (mkdir-p bin) - (install-file "qnvsm" bin))))))) - (inputs (list qtbase-5 qtdeclarative-5 nvidia-driver)) - (home-page "https://github.com/congard/nvidia-system-monitor-qt") - (synopsis "Task manager for Nvidia graphics cards") - (description - "This package provides a task manager for Nvidia graphics cards.") - (license license-gnu:expat))) + +;;; +;;; ‘nvda’ packages +;;; + ;; nvda is used as a name because it has the same length as mesa which is ;; required for grafting @@ -682,3 +480,237 @@ to use the NVIDIA driver with a package that requires mesa.") (define-public replace-mesa (package-input-rewriting `((,mesa . ,mesa/fake)))) + + +;;; +;;; Other packages +;;; + + +(define-public gpustat + (package + (name "gpustat") + (version "1.0.0") + (source (origin + (method url-fetch) + (uri (pypi-uri "gpustat" version)) + (sha256 + (base32 + "1wg3yikkqdrcxp5xscyb9rxifgfwv7qh73xv4airab63b3w8y7jq")))) + (build-system python-build-system) + (arguments + '(#:tests? #f)) + (propagated-inputs (list python-blessed python-nvidia-ml-py python-psutil + python-six)) + (native-inputs (list python-mock python-pytest python-pytest-runner)) + (home-page "https://github.com/wookayin/gpustat") + (synopsis "Utility to monitor NVIDIA GPU status and usage") + (description + "This package provides an utility to monitor NVIDIA GPU status +and usage.") + (license license-gnu:expat))) + +(define-public nvidia-exec + (package + (name "nvidia-exec") + (version "0.1.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/pedro00dk/nvidia-exec") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "079alqgz3drv5mvx059fzhj3f20rnljl7r4yihfd5qq7djgmvv0v")))) + (build-system copy-build-system) + (arguments + (list #:install-plan #~`(("nvx" "bin/")) + #:modules #~((guix build copy-build-system) + (guix build utils) + (srfi srfi-1)) + #:phases #~(modify-phases %standard-phases + (add-after 'install 'wrap-nvx + (lambda* (#:key inputs outputs #:allow-other-keys) + (wrap-program (string-append #$output "/bin/nvx") + `("PATH" ":" prefix + ,(fold (lambda (input paths) + (let* ((in (assoc-ref + inputs input)) + (bin (string-append + in "/bin"))) + (append (filter + file-exists? + (list bin)) + paths))) + '() + '("jq" "lshw" "lsof"))))))))) + (inputs (list bash-minimal jq lshw lsof)) + (home-page "https://github.com/pedro00dk/nvidia-exec") + (synopsis "GPU switching without login out for Nvidia Optimus laptops") + (description + "This package provides GPU switching without login out for Nvidia Optimus +laptops.") + (license license-gnu:gpl3+))) + +(define-public nvidia-htop + (package + (name "nvidia-htop") + (version "1.0.5") + (source (origin + (method url-fetch) + (uri (pypi-uri "nvidia-htop" version)) + (sha256 + (base32 + "0lv9cpccpkbg0d577irm1lp9rx6pacyk2pk9v41k9s9hyl4b7hvx")))) + (build-system python-build-system) + (arguments + (list #:phases #~(modify-phases %standard-phases + (add-after 'unpack 'fix-libnvidia + (lambda _ + (substitute* "nvidia-htop.py" + (("nvidia-smi") + (string-append #$(this-package-input + "nvidia-driver") + "/bin/nvidia-smi")))))))) + (inputs (list nvidia-driver)) + (propagated-inputs (list python-termcolor)) + (home-page "https://github.com/peci1/nvidia-htop") + (synopsis "Tool to enrich the output of nvidia-smi") + (description "This package provides tool for enriching the output of +nvidia-smi.") + (license license-gnu:bsd-3))) + +(define-public nvidia-nvml + (package + (name "nvidia-nvml") + (version "352.79") + (source + (origin + (method url-fetch) + (uri (string-append "https://developer.download.nvidia.com/compute/cuda/7.5/Prod/gdk/" + (format #f "gdk_linux_amd64_~a_release.run" + (string-replace-substring version "." "_")))) + (sha256 + (base32 + "1r2cwm0j9svaasky3qw46cpg2q6rrazwzrc880nxh6bismyd3a9z")) + (file-name (string-append "nvidia-nvml-" version "-checkout")))) + (build-system copy-build-system) + (arguments + (list #:phases + #~(modify-phases %standard-phases + (replace 'unpack + (lambda _ + (invoke "sh" #$source "--tar" "xvf")))) + #:install-plan + ''(("payload/nvml/lib" "lib") + ("payload/nvml/include" "include/nvidia/gdk") + ("payload/nvml/example" "src/gdk/nvml/examples") + ("payload/nvml/doc/man" "share/man") + ("payload/nvml/README.txt" "README.txt") + ("payload/nvml/COPYRIGHT.txt" "COPYRIGHT.txt")))) + (home-page "https://www.nvidia.com") + (synopsis "The NVIDIA Management Library (NVML)") + (description "C-based programmatic interface for monitoring and managing various +states within NVIDIA Tesla GPUs. It is intended to be a platform for +building 3rd party applications, and is also the underlying library for the +NVIDIA-supported nvidia-smi tool. NVML is thread-safe so it is safe to make +simultaneous NVML calls from multiple threads.") + ;; Doesn't have any specific LICENSE file, but see COPYRIGHT.txt for details. + (license (license:nonfree "file://COPYRIGHT.txt")))) + +(define-public nvidia-system-monitor + (package + (name "nvidia-system-monitor") + (version "1.5") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/congard/nvidia-system-monitor-qt") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0aghdqljvjmc02g9jpc7sb3yhha738ywny51riska56hkxd3jg2l")))) + (build-system cmake-build-system) + (arguments + (list #:tests? #f + #:phases #~(modify-phases %standard-phases + (add-after 'unpack 'fix-nvidia-smi + (lambda _ + (let ((nvidia-smi (string-append #$(this-package-input + "nvidia-driver") + "/bin/nvidia-smi"))) + (substitute* "src/core/InfoProvider.cpp" + (("nvidia-smi") + nvidia-smi)) + (substitute* "src/main.cpp" + (("which nvidia-smi") + (string-append "which " nvidia-smi)) + (("exec..nvidia-smi") + (string-append "exec(\"" nvidia-smi)))))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((bin (string-append #$output "/bin"))) + (mkdir-p bin) + (install-file "qnvsm" bin))))))) + (inputs (list qtbase-5 qtdeclarative-5 nvidia-driver)) + (home-page "https://github.com/congard/nvidia-system-monitor-qt") + (synopsis "Task manager for Nvidia graphics cards") + (description + "This package provides a task manager for Nvidia graphics cards.") + (license license-gnu:expat))) + +(define-public python-nvidia-ml-py + (package + (name "python-nvidia-ml-py") + (version "11.495.46") + (source (origin + (method url-fetch) + (uri (pypi-uri "nvidia-ml-py" version)) + (sha256 + (base32 + "09cnb7xasd7brby52j70y7fqsfm9n6gvgqf769v0cmj74ypy2s4g")))) + (build-system python-build-system) + (arguments + (list #:phases #~(modify-phases %standard-phases + (add-after 'unpack 'fix-libnvidia + (lambda _ + (substitute* "pynvml.py" + (("libnvidia-ml.so.1") + (string-append #$(this-package-input + "nvidia-driver") + "/lib/libnvidia-ml.so.1")))))))) + (inputs (list nvidia-driver)) + (home-page "https://forums.developer.nvidia.com") + (synopsis "Python Bindings for the NVIDIA Management Library") + (description "This package provides official Python Bindings for the NVIDIA +Management Library") + (license license-gnu:bsd-3))) + +(define-public python-py3nvml + (package + (name "python-py3nvml") + (version "0.2.7") + (source (origin + (method url-fetch) + (uri (pypi-uri "py3nvml" version)) + (sha256 + (base32 + "0wxxky9amy38q7qjsdmmznk1kqdzwd680ps64i76cvlab421vvh9")))) + (build-system python-build-system) + (arguments + (list #:phases #~(modify-phases %standard-phases + (add-after 'unpack 'fix-libnvidia + (lambda _ + (substitute* "py3nvml/py3nvml.py" + (("libnvidia-ml.so.1") + (string-append #$(this-package-input + "nvidia-driver") + "/lib/libnvidia-ml.so.1")))))))) + (propagated-inputs (list nvidia-driver python-xmltodict)) + (home-page "https://github.com/fbcotter/py3nvml") + (synopsis "Unoffcial Python 3 Bindings for the NVIDIA Management Library") + (description "This package provides unofficial Python 3 Bindings for the +NVIDIA Management Library") + (license license-gnu:bsd-3)))