aboutsummaryrefslogtreecommitdiff
path: root/tw/system
diff options
context:
space:
mode:
authorTimo Wilken2023-04-29 20:08:45 +0200
committerTimo Wilken2023-10-08 15:37:43 +0200
commit8f82ac69d632203638608fef34dfa808ce4df016 (patch)
tree891ef3d78f384500c07420252c6a595c3b43ec8e /tw/system
parentaf11b425fb54cad70304425d04f241a456919e85 (diff)
Use dirty, proprietary NVIDIA driver
For hopefully better gaming performance.
Diffstat (limited to 'tw/system')
-rw-r--r--tw/system/lap.scm69
1 files changed, 34 insertions, 35 deletions
diff --git a/tw/system/lap.scm b/tw/system/lap.scm
index fb836d0d..2a9a10ed 100644
--- a/tw/system/lap.scm
+++ b/tw/system/lap.scm
@@ -14,6 +14,9 @@
#:use-module ((guix utils) #:select (substitute-keyword-arguments))
#:use-module ((nongnu packages linux)
#:prefix nongnu:) ; don't interfere with (gnu packages linux)
+ #:use-module (nongnu packages nvidia)
+ #:use-module (nongnu packages scanner)
+ #:use-module (nongnu services nvidia)
#:use-module (nongnu system linux-initrd)
#:use-module (nonguix licenses)
#:use-module (tw channels)
@@ -73,9 +76,11 @@ EndSection
(define custom-xorg-config
(xorg-configuration
(keyboard-layout %british-keyboard)
- (modules (list xf86-video-vesa xf86-video-fbdev xf86-video-intel xf86-video-nouveau
- xf86-input-libinput xf86-input-keyboard xf86-input-mouse))
- (extra-config (list touchpad-xorg-config))))
+ (extra-config (list touchpad-xorg-config))
+ ;; TODO: run acpid so nvidia driver can connect?
+ ;; See `guix show nvidia-driver'
+ (modules (cons* nvidia-driver %default-xorg-modules))
+ (drivers '("nvidia" "modesetting"))))
(define set-timezone-script
;; Every time we connect to a network, get our timezone from network geolocation.
@@ -99,35 +104,6 @@ EndSection
(format (current-error-port)
"Successfully updated timezone to ~a~%" timezone))))))
-;; TODO: Nouveau claims (in dmesg) that I have a NVIDIA GM204. Maybe
-;; only use (select-firmware "^nvidia/gm204/"). linux-firmware only
-;; has a gr/ subdir for that, and acr/ symlinked from gm200. No pmu/
-;; (power management), sadly. (See WHENCE file
-;; https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/WHENCE
-;; for symlinks).
-(define nouveau-firmware
- (package
- (inherit nongnu:linux-firmware)
- (name "nouveau-firmware")
- (arguments
- `(#:license-file-regexp "LICENSE.nvidia"
- ,@(substitute-keyword-arguments (package-arguments nongnu:linux-firmware)
- ((#:phases phases)
- `(modify-phases ,phases
- (add-after 'unpack 'select-firmware
- ,((@@ (nongnu packages linux) select-firmware)
- "^nvidia/(g|tu)"))))))) ; `select-firmware' is private
- (home-page "https://www.nvidia.com/en-us/drivers/unix/")
- (synopsis "Nonfree firmware for NVIDIA graphics chips")
- (description "\
-Nonfree firmware for NVIDIA graphics chips. Required for nouveau to
-support extra features (acr, pmu, gr).")
- (license
- (nonfree
- (string-append
- "https://git.kernel.org/pub/scm/linux/kernel/git/firmware"
- "/linux-firmware.git/plain/LICENSE.nvidia")))))
-
(define-public %lap-system
(operating-system
(host-name "lap.twilken.net")
@@ -165,15 +141,17 @@ support extra features (acr, pmu, gr).")
(cons* ;;"nosplash"
;;"vt.global_cursor_default=0"
;;"video.use_native_backlight=1"
- ;;"nvidia-drm.modeset=1"
+ ;; Needed for PRIME synchronization:
+ ;; https://wiki.archlinux.org/title/PRIME#PRIME_synchronization
+ ;; https://wiki.archlinux.org/title/NVIDIA#DRM_kernel_mode_setting
+ "nvidia-drm.modeset=1"
;;"acpi_osi=\"!Windows 2015\""
;;"acpi_enforce_resources=lax"
+ "modprobe.blacklist=nouveau" ; prevent interference with nvidia
%default-kernel-arguments))
(initrd microcode-initrd)
- ;; TODO: nouveau complains about missing firmware (see dmesg).
(firmware (cons* nongnu:atheros-firmware ; for atk10k/QCA6174/hw3.0 (wifi card)
nongnu:i915-firmware ; for Intel GPU runtime power management etc
- nouveau-firmware ; for nouveau to use NVIDIA GPU
%base-firmware))
;; Specify a mapped device for the encrypted home partition.
@@ -266,6 +244,8 @@ support extra features (acr, pmu, gr).")
;; gets added to `%desktop-services' and redshift can access the
;; location.
geoclue
+ ;; Proprietary NVIDIA driver. See its description for more required setup steps.
+ nvidia-driver
;; Base packages
%base-system-packages))
@@ -344,6 +324,25 @@ support extra features (acr, pmu, gr).")
(set-xorg-configuration custom-xorg-config)
+ (service nvidia-service-type) ; proprietary nvidia driver
+
+ ;; For some reason, none of the NVIDIA things create this device file
+ ;; automatically, even though the NVIDIA Xorg driver requires it (Xorg
+ ;; fails to start otherwise).
+ (simple-service 'create-nvidiactl shepherd-root-service-type
+ (list
+ (shepherd-service
+ (documentation "Create /dev/nvidiactl.")
+ (provision '(nvidiactl))
+ (requirement '(nvidia))
+ (one-shot? #t)
+ (start #~(make-forkexec-constructor
+ (list #$(file-append coreutils "/bin/mknod")
+ "-m" "666" "/dev/nvidiactl" "c" "195" "255")))
+ (stop #~(make-forkexec-constructor
+ (list #$(file-append coreutils "/bin/rm")
+ "-f" "/dev/nvidiactl"))))))
+
(service unattended-upgrade-service-type
(unattended-upgrade-configuration
(schedule "0 21 * * *") ; every night at 21:00, when the laptop is turned on