2022-12-19 17:17:39 +01:00
|
|
|
|
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
2020-11-19 04:38:41 +01:00
|
|
|
|
;;; Copyright © 2020 Hebi Li <hebi@lihebi.com>
|
|
|
|
|
;;; Copyright © 2020 Malte Frank Gerdes <malte.f.gerdes@gmail.com>
|
2021-04-12 13:39:42 +02:00
|
|
|
|
;;; Copyright © 2020, 2021 Jean-Baptiste Volatier <jbv@pm.me>
|
2022-06-08 05:47:51 +02:00
|
|
|
|
;;; Copyright © 2020-2022 Jonathan Brielmaier <jonathan.brielmaier@web.de>
|
2021-04-15 23:40:39 +02:00
|
|
|
|
;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
|
2023-01-16 00:48:32 +01:00
|
|
|
|
;;; Copyright © 2022, 2023 Petr Hodina <phodina@protonmail.com>
|
2022-06-11 07:31:33 +02:00
|
|
|
|
;;; Copyright © 2022 Alexey Abramov <levenson@mmer.org>
|
2022-11-20 14:15:40 +01:00
|
|
|
|
;;; Copyright © 2022 Hilton Chain <hako@ultrarare.space>
|
2020-11-19 04:38:41 +01:00
|
|
|
|
|
|
|
|
|
(define-module (nongnu packages nvidia)
|
|
|
|
|
#:use-module (guix packages)
|
2022-10-01 05:02:35 +02:00
|
|
|
|
#:use-module (guix deprecation)
|
2020-11-19 04:38:41 +01:00
|
|
|
|
#:use-module (guix download)
|
2022-06-08 05:42:24 +02:00
|
|
|
|
#:use-module (guix gexp)
|
2022-01-27 12:45:39 +01:00
|
|
|
|
#:use-module (guix git-download)
|
2020-11-19 04:38:41 +01:00
|
|
|
|
#:use-module (guix utils)
|
2022-01-27 12:45:39 +01:00
|
|
|
|
#:use-module ((guix licenses) #:prefix license-gnu:)
|
2020-11-19 04:38:41 +01:00
|
|
|
|
#:use-module ((nonguix licenses) #:prefix license:)
|
|
|
|
|
#:use-module (guix build-system linux-module)
|
2022-03-01 16:06:53 +01:00
|
|
|
|
#:use-module (guix build-system cmake)
|
2021-04-12 16:19:55 +02:00
|
|
|
|
#:use-module (guix build-system copy)
|
2020-11-19 04:38:41 +01:00
|
|
|
|
#:use-module (guix build-system gnu)
|
2023-01-16 00:48:32 +01:00
|
|
|
|
#:use-module (guix build-system python)
|
2021-04-12 16:19:55 +02:00
|
|
|
|
#:use-module (guix build-system trivial)
|
2020-11-19 04:38:41 +01:00
|
|
|
|
#:use-module (gnu packages base)
|
|
|
|
|
#:use-module (gnu packages bash)
|
|
|
|
|
#:use-module (gnu packages bootstrap)
|
2022-01-29 20:53:39 +01:00
|
|
|
|
#:use-module (gnu packages check)
|
2020-11-19 04:38:41 +01:00
|
|
|
|
#:use-module (gnu packages compression)
|
|
|
|
|
#:use-module (gnu packages elf)
|
|
|
|
|
#:use-module (gnu packages freedesktop)
|
2022-10-01 04:05:46 +02:00
|
|
|
|
#:use-module (gnu packages gawk)
|
2020-11-19 04:38:41 +01:00
|
|
|
|
#:use-module (gnu packages gcc)
|
2021-04-12 16:19:55 +02:00
|
|
|
|
#:use-module (gnu packages gl)
|
2020-11-19 04:38:41 +01:00
|
|
|
|
#:use-module (gnu packages glib)
|
|
|
|
|
#:use-module (gnu packages gtk)
|
|
|
|
|
#:use-module (gnu packages linux)
|
2022-01-27 12:45:39 +01:00
|
|
|
|
#:use-module (gnu packages m4)
|
2022-03-06 22:17:09 +01:00
|
|
|
|
#:use-module (gnu packages lsof)
|
2022-01-27 12:45:39 +01:00
|
|
|
|
#:use-module (gnu packages pkg-config)
|
2022-01-29 20:53:39 +01:00
|
|
|
|
#:use-module (gnu packages python-xyz)
|
2022-03-01 16:06:53 +01:00
|
|
|
|
#:use-module (gnu packages qt)
|
2022-01-27 12:45:39 +01:00
|
|
|
|
#:use-module (gnu packages video)
|
2022-03-06 22:17:09 +01:00
|
|
|
|
#:use-module (gnu packages web)
|
2022-11-21 06:54:25 +01:00
|
|
|
|
#:use-module (gnu packages xdisorg)
|
2022-08-28 16:08:34 +02:00
|
|
|
|
#:use-module (gnu packages xml)
|
2020-11-19 04:38:41 +01:00
|
|
|
|
#:use-module (gnu packages xorg)
|
|
|
|
|
#:use-module (nongnu packages linux)
|
2024-02-01 11:39:27 +01:00
|
|
|
|
#:use-module (ice-9 match))
|
2020-11-19 04:38:41 +01:00
|
|
|
|
|
2024-01-31 13:24:33 +01:00
|
|
|
|
(define-public %nvidia-environment-variable-regexps
|
|
|
|
|
'("^__GL_" ; NVIDIA OpenGL settings.
|
|
|
|
|
"^__GLX_VENDOR_LIBRARY_NAME$" ; For GLVND.
|
|
|
|
|
;; NVIDIA PRIME Render Offload.
|
|
|
|
|
"^__NV_PRIME_RENDER_OFFLOAD(_PROVIDER)?$"
|
|
|
|
|
"^__VK_LAYER_NV_optimus$"
|
|
|
|
|
;; NVIDIA NGX.
|
|
|
|
|
"^__NGX_CONF_FILE$"
|
|
|
|
|
"^__NV_SIGNED_LOAD_CHECK$"
|
|
|
|
|
"^PROTON_ENABLE_NGX_UPDATER$"
|
|
|
|
|
;; NVIDIA VDPAU settings.
|
|
|
|
|
"^VDPAU_NVIDIA_"
|
|
|
|
|
;; GSYNC control for Vulkan direct-to-display applications.
|
|
|
|
|
"^VKDirectGSYNC(Compatible)?Allowed$"))
|
|
|
|
|
|
2024-02-01 11:39:27 +01:00
|
|
|
|
(define-public nvidia-version "515.76")
|
2022-03-07 09:49:39 +01:00
|
|
|
|
|
2024-02-01 11:39:27 +01:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; NVIDIA driver checkouts
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
|
2024-02-01 13:46:05 +01:00
|
|
|
|
(define (nvidia-source-unbundle-libraries version)
|
2023-12-15 13:59:52 +01:00
|
|
|
|
#~(begin
|
|
|
|
|
(use-modules (guix build utils))
|
|
|
|
|
(for-each delete-file
|
|
|
|
|
(find-files "." (string-join
|
2024-01-29 10:12:53 +01:00
|
|
|
|
'(;; egl-gbm
|
|
|
|
|
"libnvidia-egl-gbm\\.so\\."
|
|
|
|
|
;; egl-wayland
|
|
|
|
|
"libnvidia-egl-wayland\\.so\\."
|
|
|
|
|
;; nvidia-settings
|
2024-01-29 09:59:07 +01:00
|
|
|
|
"libnvidia-gtk[23]\\.so\\."
|
|
|
|
|
;; opencl-icd-loader
|
|
|
|
|
"libOpenCL\\.so\\.")
|
2023-12-15 13:59:52 +01:00
|
|
|
|
"|")))))
|
2024-02-01 13:46:05 +01:00
|
|
|
|
|
|
|
|
|
(define* (make-nvidia-source
|
|
|
|
|
version hash
|
|
|
|
|
#:optional (get-cleanup-snippet nvidia-source-unbundle-libraries))
|
|
|
|
|
"Given VERSION and HASH of an NVIDIA driver installer, return an <origin> for
|
|
|
|
|
its unpacked checkout. GET-CLEANUP-SNIPPET is a procedure that accepts the
|
|
|
|
|
VERSION as argument and returns a G-expression."
|
|
|
|
|
(define installer
|
|
|
|
|
(origin
|
|
|
|
|
(method url-fetch)
|
|
|
|
|
(uri (string-append
|
|
|
|
|
"https://us.download.nvidia.com/XFree86/Linux-x86_64/"
|
|
|
|
|
version "/NVIDIA-Linux-x86_64-" version ".run"))
|
|
|
|
|
(sha256 hash)))
|
2022-10-01 04:05:46 +02:00
|
|
|
|
(origin
|
2023-12-15 15:26:50 +01:00
|
|
|
|
(method (@@ (guix packages) computed-origin-method))
|
2022-10-01 04:05:46 +02:00
|
|
|
|
(file-name (string-append "nvidia-driver-" version "-checkout"))
|
|
|
|
|
(sha256 #f)
|
2024-02-01 13:46:05 +01:00
|
|
|
|
(snippet (get-cleanup-snippet version))
|
2022-10-01 04:05:46 +02:00
|
|
|
|
(uri
|
|
|
|
|
(delay
|
|
|
|
|
(with-imported-modules '((guix build utils))
|
|
|
|
|
#~(begin
|
|
|
|
|
(use-modules (guix build utils)
|
|
|
|
|
(ice-9 ftw))
|
|
|
|
|
(set-path-environment-variable
|
|
|
|
|
"PATH" '("bin")
|
2023-12-15 15:26:50 +01:00
|
|
|
|
'#+(list bash-minimal
|
|
|
|
|
coreutils
|
|
|
|
|
gawk
|
|
|
|
|
grep
|
|
|
|
|
tar
|
|
|
|
|
which
|
|
|
|
|
xz))
|
2022-10-01 04:05:46 +02:00
|
|
|
|
(setenv "XZ_OPT" (string-join (%xz-parallel-args)))
|
|
|
|
|
(invoke "sh" #$installer "-x")
|
|
|
|
|
(copy-recursively
|
|
|
|
|
(car (scandir (canonicalize-path (getcwd))
|
|
|
|
|
(lambda (file)
|
|
|
|
|
(not (member file '("." ".."))))))
|
|
|
|
|
#$output)))))))
|
|
|
|
|
|
2024-02-01 11:39:27 +01:00
|
|
|
|
(define-public nvidia-source
|
2024-02-01 13:46:05 +01:00
|
|
|
|
(make-nvidia-source
|
|
|
|
|
nvidia-version
|
|
|
|
|
(base32 "0i5zyvlsjnfkpfqhw6pklp0ws8nndyiwxrg4pj04jpwnxf6a38n6")))
|
2022-10-01 04:05:46 +02:00
|
|
|
|
|
2024-02-01 11:39:27 +01:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; NVIDIA drivers
|
|
|
|
|
;;;
|
2022-01-30 00:04:38 +01:00
|
|
|
|
|
2022-08-28 16:08:34 +02:00
|
|
|
|
|
2024-01-07 10:10:42 +01:00
|
|
|
|
(define %nvidia-script-create-device-nodes
|
|
|
|
|
(program-file
|
|
|
|
|
"create-device-nodes.scm"
|
|
|
|
|
(with-imported-modules '((guix build utils))
|
|
|
|
|
#~(begin
|
|
|
|
|
(use-modules (ice-9 regex)
|
|
|
|
|
(rnrs io ports)
|
|
|
|
|
(srfi srfi-1)
|
|
|
|
|
(guix build utils))
|
|
|
|
|
|
|
|
|
|
(define %nvidia-character-devices
|
|
|
|
|
(call-with-input-file "/proc/devices"
|
|
|
|
|
(lambda (port)
|
|
|
|
|
(filter-map
|
|
|
|
|
(lambda (line)
|
|
|
|
|
(if (string-contains line "nvidia")
|
|
|
|
|
(apply cons (reverse (string-tokenize line)))
|
|
|
|
|
#f))
|
|
|
|
|
(string-split (get-string-all port) #\newline)))))
|
|
|
|
|
|
|
|
|
|
(define %nvidia-driver-device-minors
|
|
|
|
|
(let ((device-minor-regexp (make-regexp "^Device Minor: \t (.*)")))
|
|
|
|
|
(append-map
|
|
|
|
|
(lambda (file)
|
|
|
|
|
(call-with-input-file file
|
|
|
|
|
(lambda (port)
|
|
|
|
|
(filter-map
|
|
|
|
|
(lambda (line)
|
|
|
|
|
(let ((matched (regexp-exec device-minor-regexp line)))
|
|
|
|
|
(if matched
|
|
|
|
|
(match:substring matched 1)
|
|
|
|
|
#f)))
|
|
|
|
|
(string-split (get-string-all port) #\newline)))))
|
|
|
|
|
(find-files "/proc/driver/nvidia/gpus/" "information$"))))
|
|
|
|
|
|
|
|
|
|
(define (create-device-node path name minor)
|
|
|
|
|
(let ((major
|
|
|
|
|
(or (assoc-ref %nvidia-character-devices name)
|
|
|
|
|
(assoc-ref %nvidia-character-devices "nvidia-frontend")))
|
|
|
|
|
(mknod #$(file-append coreutils "/bin/mknod")))
|
|
|
|
|
(system* mknod "-Zm0666" path "c" major minor)))
|
|
|
|
|
|
|
|
|
|
(define (main args)
|
|
|
|
|
(case (string->symbol (first args))
|
|
|
|
|
((nvidia_modeset)
|
|
|
|
|
(create-device-node "/dev/nvidia-modeset" "nvidia-modeset" "254"))
|
|
|
|
|
((nvidia_uvm)
|
|
|
|
|
(begin
|
|
|
|
|
(create-device-node "/dev/nvidia-uvm" "nvidia-uvm" "0")
|
|
|
|
|
(create-device-node "/dev/nvidia-uvm-tools" "nvidia-uvm" "1")))
|
|
|
|
|
((nvidia)
|
|
|
|
|
(begin
|
|
|
|
|
(create-device-node "/dev/nvidiactl" "nvidiactl" "255")
|
|
|
|
|
(for-each
|
|
|
|
|
(lambda (minor)
|
|
|
|
|
(create-device-node
|
|
|
|
|
(string-append "/dev/nvidia" minor) "nvidia" minor))
|
|
|
|
|
%nvidia-driver-device-minors)))))
|
|
|
|
|
|
|
|
|
|
(main (cdr (command-line)))))))
|
|
|
|
|
|
|
|
|
|
;; Adapted from <https://github.com/Frogging-Family/nvidia-all/blob/master/60-nvidia.rules>
|
|
|
|
|
(define %nvidia-udev-rules
|
|
|
|
|
(mixed-text-file
|
|
|
|
|
"90-nvidia.rules" "\
|
|
|
|
|
# Make sure device nodes are present even when the DDX is not started for the Wayland/EGLStream case
|
|
|
|
|
KERNEL==\"nvidia\", RUN+=\"" %nvidia-script-create-device-nodes " nvidia\"
|
|
|
|
|
KERNEL==\"nvidia_modeset\", RUN+=\"" %nvidia-script-create-device-nodes " nvidia_modeset\"
|
|
|
|
|
KERNEL==\"nvidia_uvm\", RUN+=\"" %nvidia-script-create-device-nodes " nvidia_uvm\"
|
|
|
|
|
|
|
|
|
|
# Enable runtime PM for NVIDIA VGA/3D controller devices
|
|
|
|
|
ACTION==\"bind\", SUBSYSTEM==\"pci\", ATTR{vendor}==\"0x10de\", ATTR{class}==\"0x03[0-9]*\", TEST==\"power/control\", ATTR{power/control}=\"auto\"
|
|
|
|
|
# Enable runtime PM for NVIDIA Audio devices
|
|
|
|
|
ACTION==\"bind\", SUBSYSTEM==\"pci\", ATTR{vendor}==\"0x10de\", ATTR{class}==\"0x040300\", TEST==\"power/control\", ATTR{power/control}=\"auto\"
|
|
|
|
|
# Enable runtime PM for NVIDIA USB xHCI Host Controller devices
|
|
|
|
|
ACTION==\"bind\", SUBSYSTEM==\"pci\", ATTR{vendor}==\"0x10de\", ATTR{class}==\"0x0c0330\", TEST==\"power/control\", ATTR{power/control}=\"auto\"
|
|
|
|
|
# Enable runtime PM for NVIDIA USB Type-C UCSI devices
|
|
|
|
|
ACTION==\"bind\", SUBSYSTEM==\"pci\", ATTR{vendor}==\"0x10de\", ATTR{class}==\"0x0c8000\", TEST==\"power/control\", ATTR{power/control}=\"auto\"
|
|
|
|
|
|
|
|
|
|
# Disable runtime PM for NVIDIA VGA/3D controller devices
|
|
|
|
|
ACTION==\"unbind\", SUBSYSTEM==\"pci\", ATTR{vendor}==\"0x10de\", ATTR{class}==\"0x03[0-9]*\", TEST==\"power/control\", ATTR{power/control}=\"on\"
|
|
|
|
|
# Disable runtime PM for NVIDIA Audio devices
|
|
|
|
|
ACTION==\"unbind\", SUBSYSTEM==\"pci\", ATTR{vendor}==\"0x10de\", ATTR{class}==\"0x040300\", TEST==\"power/control\", ATTR{power/control}=\"on\"
|
|
|
|
|
# Disable runtime PM for NVIDIA USB xHCI Host Controller devices
|
|
|
|
|
ACTION==\"unbind\", SUBSYSTEM==\"pci\", ATTR{vendor}==\"0x10de\", ATTR{class}==\"0x0c0330\", TEST==\"power/control\", ATTR{power/control}=\"on\"
|
|
|
|
|
# Disable runtime PM for NVIDIA USB Type-C UCSI devices
|
|
|
|
|
ACTION==\"unbind\", SUBSYSTEM==\"pci\", ATTR{vendor}==\"0x10de\", ATTR{class}==\"0x0c8000\", TEST==\"power/control\", ATTR{power/control}=\"on\"
|
|
|
|
|
"))
|
|
|
|
|
|
2020-11-19 04:38:41 +01:00
|
|
|
|
(define-public nvidia-driver
|
|
|
|
|
(package
|
|
|
|
|
(name "nvidia-driver")
|
2022-03-07 09:49:39 +01:00
|
|
|
|
(version nvidia-version)
|
2022-10-01 04:05:46 +02:00
|
|
|
|
(source nvidia-source)
|
2022-11-21 06:14:34 +01:00
|
|
|
|
(build-system copy-build-system)
|
2020-11-19 04:38:41 +01:00
|
|
|
|
(arguments
|
2022-11-21 06:14:34 +01:00
|
|
|
|
(list #:modules '((guix build copy-build-system)
|
2022-11-20 15:59:19 +01:00
|
|
|
|
(guix build utils)
|
|
|
|
|
(ice-9 popen)
|
|
|
|
|
(ice-9 rdelim)
|
|
|
|
|
(ice-9 regex)
|
2024-01-27 11:59:55 +01:00
|
|
|
|
(srfi srfi-26))
|
2022-11-21 06:14:34 +01:00
|
|
|
|
#:install-plan
|
2024-01-27 11:59:55 +01:00
|
|
|
|
#~`((#$(match (or (%current-target-system) (%current-system))
|
|
|
|
|
("i686-linux" "32")
|
|
|
|
|
("x86_64-linux" ".")
|
|
|
|
|
(_ "."))
|
|
|
|
|
"lib/" #:include-regexp ("^./[^/]+\\.so"))
|
|
|
|
|
("." "share/nvidia/" #:include-regexp ("nvidia-application-profiles"))
|
|
|
|
|
("." "share/egl/egl_external_platform.d/" #:include-regexp ("(gbm|wayland)\\.json"))
|
2024-01-24 15:45:56 +01:00
|
|
|
|
("10_nvidia.json" "share/glvnd/egl_vendor.d/")
|
2022-11-21 06:14:34 +01:00
|
|
|
|
("90-nvidia.rules" "lib/udev/rules.d/")
|
2024-01-27 11:59:55 +01:00
|
|
|
|
("nvidia-drm-outputclass.conf" "share/X11/xorg.conf.d/")
|
2022-11-21 06:54:25 +01:00
|
|
|
|
("nvidia-dbus.conf" "share/dbus-1/system.d/")
|
2022-11-21 06:14:34 +01:00
|
|
|
|
("nvidia.icd" "etc/OpenCL/vendors/")
|
|
|
|
|
("nvidia_icd.json" "share/vulkan/icd.d/")
|
2024-01-27 11:59:55 +01:00
|
|
|
|
("nvidia_layers.json" "share/vulkan/implicit_layer.d/"))
|
2022-11-20 14:15:40 +01:00
|
|
|
|
#:phases
|
|
|
|
|
#~(modify-phases %standard-phases
|
|
|
|
|
(delete 'strip)
|
2022-11-21 06:14:34 +01:00
|
|
|
|
(add-after 'unpack 'create-misc-files
|
|
|
|
|
(lambda* (#:key inputs #:allow-other-keys)
|
2024-01-27 11:59:55 +01:00
|
|
|
|
;; EGL external platform configuraiton
|
|
|
|
|
(substitute* '("10_nvidia_wayland.json"
|
|
|
|
|
"15_nvidia_gbm.json")
|
|
|
|
|
(("libnvidia-egl-(wayland|gbm)\\.so\\.." all)
|
2024-01-29 10:12:53 +01:00
|
|
|
|
(search-input-file inputs (string-append "lib/" all))))
|
2020-11-19 04:38:41 +01:00
|
|
|
|
|
2024-01-24 15:45:56 +01:00
|
|
|
|
;; EGL vendor ICD configuration
|
|
|
|
|
(substitute* "10_nvidia.json"
|
|
|
|
|
(("libEGL_nvidia\\.so\\.." all)
|
|
|
|
|
(string-append #$output "/lib/" all)))
|
|
|
|
|
|
2022-11-21 06:14:34 +01:00
|
|
|
|
;; OpenCL vendor ICD configuration
|
|
|
|
|
(substitute* "nvidia.icd"
|
2024-01-27 11:59:55 +01:00
|
|
|
|
(("libnvidia-opencl\\.so\\.." all)
|
|
|
|
|
(string-append #$output "/lib/" all)))
|
|
|
|
|
|
|
|
|
|
;; Vulkan ICD & layer configuraiton
|
|
|
|
|
(substitute* '("nvidia_icd.json"
|
|
|
|
|
"nvidia_layers.json")
|
|
|
|
|
(("libGLX_nvidia\\.so\\.." all)
|
|
|
|
|
(string-append #$output "/lib/" all)))
|
2020-11-19 04:38:41 +01:00
|
|
|
|
|
2024-01-07 10:10:42 +01:00
|
|
|
|
;; Add udev rules
|
|
|
|
|
(symlink #$%nvidia-udev-rules "90-nvidia.rules")))
|
2024-01-29 11:20:43 +01:00
|
|
|
|
(add-after 'install 'add-architecture-to-filename
|
|
|
|
|
(lambda _
|
|
|
|
|
(for-each
|
|
|
|
|
(lambda (path)
|
|
|
|
|
(let* ((out #$output)
|
|
|
|
|
(system #$(or (%current-target-system)
|
|
|
|
|
(%current-system)))
|
|
|
|
|
(dash (string-index system #\-))
|
|
|
|
|
(arch (string-take system dash))
|
|
|
|
|
|
|
|
|
|
(dot (string-index-right path #\.))
|
|
|
|
|
(base (string-take path dot))
|
|
|
|
|
(ext (string-drop path (+ 1 dot))))
|
|
|
|
|
;; <...>/nvidia.icd -> <...>/nvidia.x86_64.icd
|
|
|
|
|
;; <...>/nvidia_icd.json -> <...>/nvidia_icd.x86_64.json
|
|
|
|
|
(rename-file
|
|
|
|
|
(string-append out path)
|
|
|
|
|
(string-append out base "." arch "." ext))))
|
|
|
|
|
'("/etc/OpenCL/vendors/nvidia.icd"
|
|
|
|
|
"/share/egl/egl_external_platform.d/10_nvidia_wayland.json"
|
|
|
|
|
"/share/egl/egl_external_platform.d/15_nvidia_gbm.json"
|
|
|
|
|
"/share/glvnd/egl_vendor.d/10_nvidia.json"
|
|
|
|
|
"/share/vulkan/icd.d/nvidia_icd.json"
|
|
|
|
|
"/share/vulkan/implicit_layer.d/nvidia_layers.json"))))
|
2022-11-21 06:23:22 +01:00
|
|
|
|
(add-after 'install 'patch-elf
|
2022-11-21 06:19:39 +01:00
|
|
|
|
(lambda _
|
|
|
|
|
(let* ((ld.so (string-append #$(this-package-input "glibc")
|
|
|
|
|
#$(glibc-dynamic-linker)))
|
|
|
|
|
(rpath (string-join
|
2024-01-27 11:59:55 +01:00
|
|
|
|
(list (string-append #$output "/lib")
|
2024-01-29 10:12:53 +01:00
|
|
|
|
(string-append #$(this-package-input "egl-wayland") "/lib")
|
2024-01-27 11:59:55 +01:00
|
|
|
|
(string-append (ungexp (this-package-input "gcc") "lib") "/lib")
|
2022-11-21 06:19:39 +01:00
|
|
|
|
(string-append #$(this-package-input "glibc") "/lib")
|
2022-11-21 06:54:25 +01:00
|
|
|
|
(string-append #$(this-package-input "libdrm") "/lib")
|
2022-11-21 06:19:39 +01:00
|
|
|
|
(string-append #$(this-package-input "libx11") "/lib")
|
|
|
|
|
(string-append #$(this-package-input "libxext") "/lib")
|
|
|
|
|
(string-append #$(this-package-input "wayland") "/lib"))
|
|
|
|
|
":")))
|
|
|
|
|
(define (patch-elf file)
|
|
|
|
|
(format #t "Patching ~a ..." file)
|
|
|
|
|
(unless (string-contains file ".so")
|
|
|
|
|
(invoke "patchelf" "--set-interpreter" ld.so file))
|
|
|
|
|
(invoke "patchelf" "--set-rpath" rpath file)
|
|
|
|
|
(display " done\n"))
|
2024-01-27 11:59:55 +01:00
|
|
|
|
|
2022-11-21 06:19:39 +01:00
|
|
|
|
(for-each (lambda (file)
|
|
|
|
|
(when (elf-file? file)
|
|
|
|
|
(patch-elf file)))
|
2024-01-27 11:59:55 +01:00
|
|
|
|
(find-files #$output)))))
|
|
|
|
|
(add-before 'patch-elf 'install-commands
|
|
|
|
|
(lambda _
|
|
|
|
|
(when (string-match
|
|
|
|
|
"x86_64-linux"
|
|
|
|
|
(or #$(%current-target-system) #$(%current-system)))
|
|
|
|
|
(for-each
|
|
|
|
|
(lambda (binary)
|
|
|
|
|
(let ((bindir (string-append #$output "/bin"))
|
|
|
|
|
(manual (string-append binary ".1.gz"))
|
|
|
|
|
(mandir (string-append #$output "/share/man/man1")))
|
|
|
|
|
(install-file binary bindir)
|
|
|
|
|
(when (file-exists? manual)
|
|
|
|
|
(install-file manual mandir))))
|
|
|
|
|
'("nvidia-smi")))))
|
|
|
|
|
(add-before 'patch-elf 'relocate-libraries
|
2023-06-22 00:30:27 +02:00
|
|
|
|
(lambda _
|
2024-01-24 15:41:57 +01:00
|
|
|
|
(let* ((version #$(package-version this-package))
|
|
|
|
|
(libdir (string-append #$output "/lib"))
|
|
|
|
|
(gbmdir (string-append libdir "/gbm"))
|
|
|
|
|
(vdpaudir (string-append libdir "/vdpau"))
|
2024-01-27 11:59:55 +01:00
|
|
|
|
(xorgmoddir (string-append libdir "/xorg/modules"))
|
|
|
|
|
(xorgdrvdir (string-append xorgmoddir "/drivers"))
|
|
|
|
|
(xorgextdir (string-append xorgmoddir "/extensions"))
|
|
|
|
|
(move-to-dir (lambda (file dir)
|
|
|
|
|
(install-file file dir)
|
|
|
|
|
(delete-file file))))
|
2024-01-24 15:41:57 +01:00
|
|
|
|
(for-each
|
|
|
|
|
(lambda (file)
|
|
|
|
|
(mkdir-p gbmdir)
|
|
|
|
|
(with-directory-excursion gbmdir
|
|
|
|
|
(symlink file "nvidia-drm_gbm.so")))
|
|
|
|
|
(find-files libdir "libnvidia-allocator\\.so\\."))
|
|
|
|
|
|
|
|
|
|
(for-each
|
|
|
|
|
(cut move-to-dir <> vdpaudir)
|
|
|
|
|
(find-files libdir "libvdpau_nvidia\\.so\\."))
|
|
|
|
|
|
2024-01-27 11:59:55 +01:00
|
|
|
|
(for-each
|
|
|
|
|
(cut move-to-dir <> xorgdrvdir)
|
|
|
|
|
(find-files libdir "nvidia_drv\\.so$"))
|
|
|
|
|
|
|
|
|
|
(for-each
|
|
|
|
|
(lambda (file)
|
|
|
|
|
(move-to-dir file xorgextdir)
|
|
|
|
|
(with-directory-excursion xorgextdir
|
|
|
|
|
(symlink (basename file)
|
|
|
|
|
"libglxserver_nvidia.so")))
|
|
|
|
|
(find-files libdir "libglxserver_nvidia\\.so\\.")))))
|
2022-11-21 06:23:22 +01:00
|
|
|
|
(add-after 'patch-elf 'create-short-name-symlinks
|
|
|
|
|
(lambda _
|
2022-11-21 06:19:39 +01:00
|
|
|
|
(define (get-soname file)
|
2024-02-01 11:39:27 +01:00
|
|
|
|
(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)))
|
2022-11-21 06:19:39 +01:00
|
|
|
|
(for-each
|
|
|
|
|
(lambda (lib)
|
|
|
|
|
(let ((lib-soname (get-soname lib)))
|
|
|
|
|
(when (string? lib-soname)
|
|
|
|
|
(let* ((soname (string-append
|
|
|
|
|
(dirname lib) "/" lib-soname))
|
|
|
|
|
(base (string-append
|
|
|
|
|
(regexp-substitute
|
|
|
|
|
#f (string-match "(.*)\\.so.*" soname) 1)
|
|
|
|
|
".so"))
|
|
|
|
|
(source (basename lib)))
|
|
|
|
|
(for-each
|
|
|
|
|
(lambda (target)
|
|
|
|
|
(unless (file-exists? target)
|
|
|
|
|
(format #t "Symlinking ~a -> ~a..."
|
|
|
|
|
target source)
|
|
|
|
|
(symlink source target)
|
|
|
|
|
(display " done\n")))
|
|
|
|
|
(list soname base))))))
|
2024-01-27 11:59:55 +01:00
|
|
|
|
(find-files #$output "\\.so\\.")))))))
|
2023-06-22 00:30:27 +02:00
|
|
|
|
(supported-systems '("i686-linux" "x86_64-linux"))
|
2022-10-01 04:05:46 +02:00
|
|
|
|
(native-inputs (list patchelf))
|
2020-11-19 04:38:41 +01:00
|
|
|
|
(inputs
|
2024-01-29 10:12:53 +01:00
|
|
|
|
(list egl-gbm
|
|
|
|
|
egl-wayland
|
|
|
|
|
`(,gcc "lib")
|
2022-11-20 14:15:40 +01:00
|
|
|
|
glibc
|
2022-11-21 06:54:25 +01:00
|
|
|
|
libdrm
|
2022-11-20 14:15:40 +01:00
|
|
|
|
libx11
|
|
|
|
|
libxext
|
|
|
|
|
wayland))
|
2020-11-19 04:38:41 +01:00
|
|
|
|
(home-page "https://www.nvidia.com")
|
2022-11-20 14:15:40 +01:00
|
|
|
|
(synopsis "Proprietary NVIDIA driver")
|
2022-10-01 09:08:38 +02:00
|
|
|
|
(description
|
|
|
|
|
"This is the evil NVIDIA driver. Don't forget to add @code{service
|
|
|
|
|
nvidia-service-type} to your @file{config.scm}. Further xorg should be
|
|
|
|
|
configured by adding: @code{(modules (cons* nvidia-driver
|
2024-01-27 11:59:55 +01:00
|
|
|
|
%default-xorg-modules)) (drivers '(\"nvidia\"))} to @code{xorg-configuration}.")
|
2022-11-20 14:15:40 +01:00
|
|
|
|
(license
|
|
|
|
|
(license:nonfree
|
|
|
|
|
(format #f "file:///share/doc/nvidia-driver-~a/LICENSE" version)))))
|
2021-04-12 16:19:55 +02:00
|
|
|
|
|
2024-02-01 11:39:27 +01:00
|
|
|
|
(define-public nvidia-libs
|
|
|
|
|
(deprecated-package "nvidia-libs" nvidia-driver))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; NVIDIA frimwares
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
|
2022-11-21 06:30:00 +01:00
|
|
|
|
(define-public nvidia-firmware
|
|
|
|
|
(let ((base nvidia-driver))
|
|
|
|
|
(package
|
|
|
|
|
(inherit base)
|
|
|
|
|
(name "nvidia-firmware")
|
|
|
|
|
(arguments
|
|
|
|
|
(list #:install-plan
|
|
|
|
|
#~'(("firmware" #$(string-append
|
|
|
|
|
"lib/firmware/nvidia/" (package-version base))))
|
|
|
|
|
#:phases
|
|
|
|
|
#~(modify-phases %standard-phases
|
|
|
|
|
(delete 'strip))))
|
|
|
|
|
(inputs '())
|
2024-02-01 11:39:27 +01:00
|
|
|
|
(native-inputs '()))))
|
2022-03-06 22:17:09 +01:00
|
|
|
|
|
2024-02-01 11:39:27 +01:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; NVIDIA kernel modules
|
|
|
|
|
;;;
|
2022-06-11 07:31:33 +02:00
|
|
|
|
|
2021-04-12 16:19:55 +02:00
|
|
|
|
|
2022-10-01 04:32:40 +02:00
|
|
|
|
(define-public nvidia-module
|
|
|
|
|
(package
|
|
|
|
|
(name "nvidia-module")
|
|
|
|
|
(version nvidia-version)
|
|
|
|
|
(source nvidia-source)
|
|
|
|
|
(build-system linux-module-build-system)
|
|
|
|
|
(arguments
|
|
|
|
|
(list #:linux linux-lts
|
|
|
|
|
#:source-directory "kernel"
|
|
|
|
|
#:tests? #f
|
|
|
|
|
#:make-flags
|
|
|
|
|
#~(list (string-append "CC=" #$(cc-for-target)))
|
|
|
|
|
#:phases
|
|
|
|
|
#~(modify-phases %standard-phases
|
|
|
|
|
(delete 'strip)
|
|
|
|
|
(add-before 'configure 'fixpath
|
|
|
|
|
(lambda* (#:key (source-directory ".") #:allow-other-keys)
|
|
|
|
|
(substitute* (string-append source-directory "/Kbuild")
|
|
|
|
|
(("/bin/sh") (which "sh")))))
|
|
|
|
|
(replace 'build
|
|
|
|
|
(lambda* (#:key (make-flags '()) (parallel-build? #t)
|
|
|
|
|
(source-directory ".")
|
|
|
|
|
inputs
|
|
|
|
|
#:allow-other-keys)
|
|
|
|
|
(apply invoke "make" "-C" (canonicalize-path source-directory)
|
|
|
|
|
(string-append "SYSSRC=" (search-input-directory
|
|
|
|
|
inputs "/lib/modules/build"))
|
|
|
|
|
`(,@(if parallel-build?
|
|
|
|
|
`("-j" ,(number->string
|
|
|
|
|
(parallel-job-count)))
|
|
|
|
|
'())
|
|
|
|
|
,@make-flags)))))))
|
|
|
|
|
(home-page "https://www.nvidia.com")
|
|
|
|
|
(synopsis "Proprietary NVIDIA kernel modules")
|
|
|
|
|
(description
|
|
|
|
|
"This package provides the evil NVIDIA proprietary kernel modules.")
|
|
|
|
|
(license
|
|
|
|
|
(license:nonfree
|
|
|
|
|
(format #f "file:///share/doc/nvidia-driver-~a/LICENSE" version)))))
|
|
|
|
|
|
2022-10-01 04:32:30 +02:00
|
|
|
|
(define-public nvidia-module-open
|
2022-10-01 05:24:11 +02:00
|
|
|
|
(let ((base nvidia-module))
|
|
|
|
|
(package/inherit base
|
|
|
|
|
(name "nvidia-module-open")
|
|
|
|
|
(arguments
|
|
|
|
|
(substitute-keyword-arguments (package-arguments base)
|
|
|
|
|
;; NOTE: Kernels compiled with CONFIG_LTO_CLANG_THIN would cause an
|
|
|
|
|
;; error here. See also:
|
|
|
|
|
;; <https://github.com/NVIDIA/open-gpu-kernel-modules/issues/214>
|
|
|
|
|
;; <https://github.com/llvm/llvm-project/issues/55820>
|
|
|
|
|
((#:source-directory _) "kernel-open")))
|
|
|
|
|
(home-page "https://github.com/NVIDIA/open-gpu-kernel-modules")
|
|
|
|
|
(synopsis "NVIDIA kernel module")
|
|
|
|
|
(description
|
|
|
|
|
"This package provides NVIDIA open-gpu-kernel-modules. However, they
|
|
|
|
|
are only for the latest GPU architectures Turing and Ampere. Also they still
|
|
|
|
|
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))))
|
2022-06-08 05:42:24 +02:00
|
|
|
|
|
2024-02-01 11:39:27 +01:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; ‘nvidia-settings’ packages
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
|
2022-01-27 12:45:39 +01:00
|
|
|
|
(define-public nvidia-settings
|
|
|
|
|
(package
|
|
|
|
|
(name "nvidia-settings")
|
2022-03-07 09:49:39 +01:00
|
|
|
|
(version nvidia-version)
|
2022-01-27 12:45:39 +01:00
|
|
|
|
(source (origin
|
|
|
|
|
(method git-fetch)
|
|
|
|
|
(uri (git-reference
|
|
|
|
|
(url "https://github.com/NVIDIA/nvidia-settings")
|
|
|
|
|
(commit version)))
|
|
|
|
|
(file-name (git-file-name name version))
|
2023-12-15 15:01:57 +01:00
|
|
|
|
(modules '((guix build utils)))
|
|
|
|
|
(snippet '(delete-file-recursively "src/jansson"))
|
2022-01-27 12:45:39 +01:00
|
|
|
|
(sha256
|
|
|
|
|
(base32
|
2022-11-21 06:54:25 +01:00
|
|
|
|
"1hplc42115c06cc555cjmw3c9371qn7ibwjpqjybcf6ixfd6lryq"))))
|
2022-01-27 12:45:39 +01:00
|
|
|
|
(build-system gnu-build-system)
|
|
|
|
|
(arguments
|
2022-06-08 05:47:51 +02:00
|
|
|
|
(list #:tests? #f ;no test suite
|
|
|
|
|
#:make-flags
|
2023-12-15 15:01:57 +01:00
|
|
|
|
#~(list "NV_USE_BUNDLED_LIBJANSSON=0"
|
|
|
|
|
(string-append "PREFIX=" #$output)
|
2022-06-08 05:47:51 +02:00
|
|
|
|
(string-append "CC=" #$(cc-for-target)))
|
|
|
|
|
#:phases
|
|
|
|
|
#~(modify-phases %standard-phases
|
|
|
|
|
(delete 'configure)
|
2023-12-15 15:06:49 +01:00
|
|
|
|
(add-after 'unpack 'fix-application-profile-path
|
|
|
|
|
(lambda* (#:key inputs #:allow-other-keys)
|
|
|
|
|
(substitute* "src/gtk+-2.x/ctkappprofile.c"
|
|
|
|
|
(("/usr") "/run/booted-system/profile"))))
|
2023-12-15 15:09:22 +01:00
|
|
|
|
(add-after 'install 'install-desktop-file
|
|
|
|
|
(lambda _
|
|
|
|
|
(substitute* "doc/nvidia-settings.desktop"
|
|
|
|
|
(("^Exec=.*") "Exec=nvidia-settings\n")
|
|
|
|
|
(("__NVIDIA_SETTINGS_DESKTOP_CATEGORIES__") "Settings"))
|
|
|
|
|
(install-file "doc/nvidia-settings.desktop"
|
|
|
|
|
(string-append
|
|
|
|
|
#$output "/share/applications"))
|
|
|
|
|
(install-file "doc/nvidia-settings.png"
|
|
|
|
|
(string-append
|
|
|
|
|
#$output "/share/icons/hicolor/128x128/apps"))))
|
2022-06-08 05:47:51 +02:00
|
|
|
|
(add-after 'install 'wrap-program
|
|
|
|
|
(lambda* (#:key outputs #:allow-other-keys)
|
|
|
|
|
(let ((out (assoc-ref outputs "out")))
|
|
|
|
|
(wrap-program (string-append out "/bin/nvidia-settings")
|
2024-02-01 11:39:27 +01:00
|
|
|
|
`("LD_LIBRARY_PATH" ":" prefix
|
|
|
|
|
(,(string-append out "/lib/"))))))))))
|
2022-01-27 12:45:39 +01:00
|
|
|
|
(native-inputs (list m4
|
|
|
|
|
pkg-config))
|
|
|
|
|
(inputs (list bash-minimal
|
|
|
|
|
dbus
|
|
|
|
|
glu
|
|
|
|
|
gtk+
|
|
|
|
|
gtk+-2
|
2023-12-15 15:01:57 +01:00
|
|
|
|
jansson
|
2022-01-27 12:45:39 +01:00
|
|
|
|
libvdpau
|
|
|
|
|
libx11
|
|
|
|
|
libxext
|
|
|
|
|
libxrandr
|
|
|
|
|
libxv
|
|
|
|
|
libxxf86vm))
|
|
|
|
|
(synopsis "Nvidia driver control panel")
|
|
|
|
|
(description
|
|
|
|
|
"This package provides Nvidia driver control panel for monitor
|
|
|
|
|
configuration, creating application profiles, gpu monitoring and more.")
|
|
|
|
|
(home-page "https://github.com/NVIDIA/nvidia-settings")
|
|
|
|
|
(license license-gnu:gpl2)))
|
|
|
|
|
|
2024-02-01 11:39:27 +01:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; ‘nvda’ packages
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
|
2024-01-31 11:57:42 +01:00
|
|
|
|
(define-public libglvnd-for-nvda
|
|
|
|
|
(hidden-package
|
|
|
|
|
(package
|
|
|
|
|
(inherit libglvnd)
|
|
|
|
|
(arguments
|
|
|
|
|
(substitute-keyword-arguments (package-arguments libglvnd)
|
|
|
|
|
((#:configure-flags flags #~'())
|
|
|
|
|
#~(cons* "-Dc_link_args=-Wl,-rpath=$ORIGIN" #$flags))
|
|
|
|
|
((#:phases phases #~%standard-phases)
|
|
|
|
|
#~(modify-phases #$phases
|
|
|
|
|
(delete 'shrink-runpath))))))))
|
|
|
|
|
|
2024-02-01 11:39:27 +01:00
|
|
|
|
;; nvda is used as a name because it has the same length as mesa which is
|
|
|
|
|
;; required for grafting
|
|
|
|
|
(define-public nvda
|
|
|
|
|
(package
|
|
|
|
|
(inherit nvidia-driver)
|
|
|
|
|
(name "nvda")
|
2024-01-08 03:39:40 +01:00
|
|
|
|
(version (string-pad-right
|
|
|
|
|
(package-version nvidia-driver)
|
|
|
|
|
(string-length (package-version mesa))
|
|
|
|
|
#\0))
|
2024-02-01 11:39:27 +01:00
|
|
|
|
(source #f)
|
|
|
|
|
(build-system trivial-build-system)
|
|
|
|
|
(arguments
|
|
|
|
|
(list #:modules '((guix build union))
|
|
|
|
|
#:builder
|
|
|
|
|
#~(begin
|
|
|
|
|
(use-modules (guix build union)
|
|
|
|
|
(srfi srfi-1)
|
|
|
|
|
(ice-9 regex))
|
2024-01-31 12:15:18 +01:00
|
|
|
|
(union-build
|
|
|
|
|
#$output
|
|
|
|
|
'#$(list (this-package-input "mesa")
|
|
|
|
|
(this-package-input "nvidia-driver"))
|
|
|
|
|
#:resolve-collision
|
|
|
|
|
(lambda (files)
|
|
|
|
|
(let ((file (if (string-match "nvidia-driver"
|
|
|
|
|
(first files))
|
|
|
|
|
(first files)
|
|
|
|
|
(last files))))
|
|
|
|
|
(format #t "chosen ~a ~%" file)
|
|
|
|
|
file))))))
|
2024-01-26 10:01:43 +01:00
|
|
|
|
(native-search-paths
|
|
|
|
|
(list
|
|
|
|
|
;; https://github.com/NVIDIA/egl-wayland/issues/39
|
|
|
|
|
(search-path-specification
|
|
|
|
|
(variable "__EGL_EXTERNAL_PLATFORM_CONFIG_DIRS")
|
|
|
|
|
(files '("share/egl/egl_external_platform.d")))
|
|
|
|
|
;; https://gitlab.freedesktop.org/glvnd/libglvnd/-/blob/master/src/EGL/icd_enumeration.md
|
|
|
|
|
(search-path-specification
|
|
|
|
|
(variable "__EGL_VENDOR_LIBRARY_DIRS")
|
|
|
|
|
(files '("share/glvnd/egl_vendor.d")))
|
|
|
|
|
;; See also: ‘src/gbm/main/backend.c’ in mesa source.
|
|
|
|
|
(search-path-specification
|
|
|
|
|
(variable "GBM_BACKENDS_PATH")
|
|
|
|
|
(files '("lib/gbm")))
|
|
|
|
|
(search-path-specification
|
|
|
|
|
(variable "VDPAU_DRIVER_PATH")
|
|
|
|
|
(files '("lib/vdpau"))
|
|
|
|
|
(separator #f))
|
|
|
|
|
;; https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderLayerInterface.md
|
|
|
|
|
(search-path-specification
|
|
|
|
|
(variable "XDG_DATA_DIRS")
|
|
|
|
|
(files '("share")))))
|
2024-02-01 11:39:27 +01:00
|
|
|
|
(description
|
|
|
|
|
"These are the libraries of the evil NVIDIA driver, packaged in such a
|
|
|
|
|
way that you can use the transformation option @code{--with-graft=mesa=nvda}
|
|
|
|
|
to use the NVIDIA driver with a package that requires mesa.")
|
2024-01-31 12:11:45 +01:00
|
|
|
|
(native-inputs '())
|
|
|
|
|
(propagated-inputs
|
|
|
|
|
(append
|
|
|
|
|
(package-propagated-inputs mesa)
|
|
|
|
|
(package-propagated-inputs nvidia-driver)))
|
2024-02-01 11:39:27 +01:00
|
|
|
|
(inputs (list mesa nvidia-driver))
|
|
|
|
|
(outputs '("out"))))
|
|
|
|
|
|
|
|
|
|
(define mesa/fake
|
|
|
|
|
(package
|
|
|
|
|
(inherit mesa)
|
|
|
|
|
(replacement nvda)))
|
|
|
|
|
|
|
|
|
|
(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"))))
|
|
|
|
|
|
2022-03-01 16:06:53 +01:00
|
|
|
|
(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")
|
2024-02-01 11:39:27 +01:00
|
|
|
|
"/bin/nvidia-smi")))
|
2022-03-01 16:06:53 +01:00
|
|
|
|
(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)))
|
|
|
|
|
|
2024-02-01 11:39:27 +01:00
|
|
|
|
(define-public python-nvidia-ml-py
|
2021-04-12 16:19:55 +02:00
|
|
|
|
(package
|
2024-02-01 11:39:27 +01:00
|
|
|
|
(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)
|
2021-04-12 16:19:55 +02:00
|
|
|
|
(arguments
|
2024-02-01 11:39:27 +01:00
|
|
|
|
(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)))
|
2021-04-12 16:19:55 +02:00
|
|
|
|
|
2024-02-01 11:39:27 +01:00
|
|
|
|
(define-public python-py3nvml
|
2021-04-12 16:19:55 +02:00
|
|
|
|
(package
|
2024-02-01 11:39:27 +01:00
|
|
|
|
(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)))
|