nongnu: nvidia: update driver to 495+

This commit is contained in:
Samuel Culpepper 2022-02-09 18:26:32 +01:00
parent 35533c763a
commit bb64f4c6ce
No known key found for this signature in database
GPG Key ID: EE20E25391AAB9BB

View File

@ -21,6 +21,7 @@
;;; along with this program. If not, see <https://www.gnu.org/licenses/>.
(define-module (nongnu packages nvidia)
#:use-module (gnu packages xdisorg)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix utils)
@ -54,13 +55,13 @@
(define-public nvidia-driver
(package
(name "nvidia-driver")
(version "470.86")
(version "495.46")
(source
(origin
(uri (format #f "http://us.download.nvidia.com/XFree86/Linux-x86_64/~a/~a.run"
version
(format #f "NVIDIA-Linux-x86_64-~a" version)))
(sha256 (base32 "0krwcxc0j19vjnk8sv6mx1lin2rm8hcfhc2hg266846jvcws1dsg"))
(sha256 (base32 "1xb23kimlfsailpwy7kv4l217id5jpmdc4svm9kldid0gp8pffyq"))
(method url-fetch)
(file-name (string-append "nvidia-driver-" version "-checkout"))))
(build-system linux-module-build-system)
@ -75,7 +76,7 @@
(chdir ,(format #f "NVIDIA-Linux-x86_64-~a" version))
#t)))
(replace 'build
(lambda* (#:key inputs outputs #:allow-other-keys)
(lambda* (#:key inputs outputs #:allow-other-keys)
;; We cannot use with-directory-excursion, because the install
;; phase needs to be in the kernel folder. Otherwise no .ko
;; would be installed.
@ -127,7 +128,7 @@
(rules (string-append out "/lib/udev/rules.d/90-nvidia.rules"))
(sh (string-append (assoc-ref inputs "bash-minimal") "/bin/sh"))
(mknod (string-append (assoc-ref inputs "coreutils") "/bin/mknod"))
(cut (string-append (assoc-ref inputs "coreutils") "/bin/cut"))
(cut (string-append (assoc-ref inputs "coreutils") "/bin/cut"))
(grep (string-append (assoc-ref inputs "grep") "/bin/grep")))
(mkdir-p rulesdir)
(call-with-output-file rules
@ -196,6 +197,8 @@
(string-append (assoc-ref inputs "cairo") "/lib")
(string-append (assoc-ref inputs "gdk-pixbuf") "/lib")
(string-append (assoc-ref inputs "wayland") "/lib")
(string-append (assoc-ref inputs "libdrm") "/lib") ; libdrm.so
(string-append (assoc-ref inputs "mesa") "/lib") ; libgbm.so
(string-append (assoc-ref inputs "gcc:lib") "/lib"))
":")))
(define (patch-elf file)
@ -258,6 +261,8 @@
("gtk2" ,gtk+-2)
("kmod" ,kmod)
("libc" ,glibc)
("libdrm" ,libdrm)
("mesa" ,mesa)
("libx11" ,libx11)
("libxext" ,libxext)
("linux" ,linux-lts)
@ -276,13 +281,13 @@ Further xorg should be configured by adding:
(define-public nvidia-libs
(package
(name "nvidia-libs")
(version "470.86")
(version "495.46")
(source
(origin
(uri (format #f "http://us.download.nvidia.com/XFree86/Linux-x86_64/~a/~a.run"
version
(format #f "NVIDIA-Linux-x86_64-~a" version)))
(sha256 (base32 "0krwcxc0j19vjnk8sv6mx1lin2rm8hcfhc2hg266846jvcws1dsg"))
(sha256 (base32 "1xb23kimlfsailpwy7kv4l217id5jpmdc4svm9kldid0gp8pffyq"))
(method url-fetch)
(file-name (string-append "nvidia-driver-" version "-checkout"))))
(build-system copy-build-system)
@ -298,7 +303,7 @@ Further xorg should be configured by adding:
(delete 'build)
(delete 'check)
(add-after 'install 'patch-symlink
(lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
(lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
(use-modules (ice-9 ftw)
(ice-9 regex)
(ice-9 textual-ports))
@ -326,6 +331,8 @@ Further xorg should be configured by adding:
(string-append (assoc-ref inputs "libx11") "/lib")
(string-append (assoc-ref inputs "libxext") "/lib")
(string-append (assoc-ref inputs "pango") "/lib")
(string-append (assoc-ref inputs "libdrm") "/lib") ; libdrm.so
(string-append (assoc-ref inputs "mesa") "/lib") ; libgbm.so
(string-append (assoc-ref inputs "wayland") "/lib"))
":")))
(define (patch-elf file)
@ -343,7 +350,6 @@ Further xorg should be configured by adding:
(for-each (lambda (file)
(let* ((short (regexp-substitute
#f
(string-match "([^/]*\\.so).*" file)
1))
(major (cond
@ -365,9 +371,9 @@ Further xorg should be configured by adding:
(format #t "Linking ~a to ~a ...~%" mid file)
(symlink (basename file) mid-file))))
(find-files libdir "\\.so\\."))
#t))))
#t))))
#:install-plan
,@(match (%current-system)
,@(match (%current-system)
("x86_64-linux" '(`(("." "lib" #:include-regexp ("^./[^/]+\\.so")))))
("i686-linux" '(`(("32" "lib" #:include-regexp ("^./[^/]+\\.so")))))
(_ '()))))
@ -388,14 +394,15 @@ Further xorg should be configured by adding:
("gtk2" ,gtk+-2)
("libc" ,glibc)
("libx11" ,libx11)
("libdrm" ,libdrm)
("mesa" ,mesa)
("libxext" ,libxext)
("wayland" ,wayland)))
(home-page "https://www.nvidia.com")
(synopsis "Libraries of the proprietary Nvidia driver")
(description "These are the libraries of the evil Nvidia driver compatible
with the ones usually provided by Mesa. To use these libraries with
packages that have been compiled with a mesa output, take a look at the nvda
package.")
(description "These are the libraries of the evil Nvidia driver compatible with the ones
usually provided by Mesa. To use these libraries with packages that have been
compiled with a mesa output, take a look at the nvda package.")
(license (license:nonfree (format #f "file:///share/doc/nvidia-driver-~a/LICENSE" version)))))
;; nvda is used as a name because it has the same length as mesa which is
@ -408,22 +415,27 @@ package.")
(build-system trivial-build-system)
(arguments
'(#:modules ((guix build union))
#:builder (begin
(use-modules (guix build union)
(srfi srfi-1)
(ice-9 regex))
(union-build (assoc-ref %outputs "out")
(list (assoc-ref %build-inputs "mesa") (assoc-ref %build-inputs "nvidia-libs"))
#:resolve-collision (lambda (files) (let ((file
(if (string-match "nvidia-libs" (first files))
(first files)
(last files))))
(format #t "chosen ~a ~%" file)
file)))
#t)))
#:builder
(begin
(use-modules (guix build union)
(srfi srfi-1)
(ice-9 regex))
(union-build (assoc-ref %outputs "out")
(list (assoc-ref %build-inputs "mesa")
(assoc-ref %build-inputs "nvidia-libs"))
#:resolve-collision
(lambda (files)
(let ((file
(if (string-match "nvidia-libs" (first files))
(first files)
(last files))))
(format #t "library collision: chosen ~a ~%" file)
file)))
#t)))
(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.")
@code{--with-graft=mesa=nvda} to use the nvidia driver with a package that
requires mesa.")
(inputs
`(("nvidia-libs" ,nvidia-libs)
("mesa" ,mesa)))