From 13ca70f3f8178a1bb8ad11e141c010e200d4e5a1 Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Sun, 8 Oct 2023 15:26:07 +0200 Subject: Graft nvda onto picom if necessary Picom fails on startup if using the proprietary nvidia driver but plain mesa libs. --- tw/home.scm | 28 +++++++++++++++++++--------- tw/home/cern.scm | 2 +- tw/home/lap.scm | 4 +++- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/tw/home.scm b/tw/home.scm index a933801b..4764bcf2 100644 --- a/tw/home.scm +++ b/tw/home.scm @@ -8,8 +8,10 @@ #:use-module (gnu home services shepherd) #:use-module (gnu home services ssh) #:use-module (guix gexp) + #:use-module (guix packages) ;; Don't load nongnu on hosts where it's not available, i.e. servers. #:autoload (nongnu packages messaging) (zoom) + #:autoload (nongnu packages nvidia) (nvda) #:use-module (tw gexp) #:use-module (tw packages alice) #:use-module (tw packages catppuccin) @@ -22,7 +24,7 @@ (use-package-modules admin aidc backup base calendar check chromium compression cmake compton curl databases dav disk dns dunst elf emacs emacs-xyz file finance fonts - freedesktop games gcc gimp gnome gnome-xyz gnupg gnuzilla graphviz + freedesktop games gcc gimp gl gnome gnome-xyz gnupg gnuzilla graphviz haskell-apps image-viewers imagemagick inkscape less libreoffice linux lisp llvm mail maths ncdu package-management password-utils pdf pretty-print pulseaudio pv python python-build python-check python-xyz rsync shells @@ -367,7 +369,8 @@ show_mouse=0 show_border=1 ")) -(define-public %interactive-services +(export interactive-services) +(define* (interactive-services #:key (nvidia-driver? #f)) (list ;; Configuration files for terminal-only programs in $XDG_CONFIG_HOME. (simple-service 'interactive-terminal-config home-xdg-configuration-files-service-type @@ -418,13 +421,20 @@ show_border=1 (list #$(file-append dunst "/bin/dunst")))) (stop #~(make-kill-destructor))) - (shepherd-service - (documentation "Picom compositor; enables transparent windows in X.") - (provision '(picom)) - (start #~(make-forkexec-constructor - (list #$(file-append picom "/bin/picom") - "--config" #$(local-file "home/files/picom.conf")))) - (stop #~(make-kill-destructor))) + ;; Picom needs to use the proprietary nvidia driver's libgl if that + ;; driver is used for Xorg; plain Mesa won't work then. + (let ((grafter + (if nvidia-driver? + (package-input-rewriting + `((,mesa . ,(package (inherit mesa) (replacement nvda))))) + identity))) + (shepherd-service + (documentation "Picom compositor; enables transparent windows in X.") + (provision '(picom)) + (start #~(make-forkexec-constructor + (list #$(file-append (grafter picom) "/bin/picom") + "--config" #$(local-file "home/files/picom.conf")))) + (stop #~(make-kill-destructor)))) (shepherd-service (documentation "Source Xresources on login.") diff --git a/tw/home/cern.scm b/tw/home/cern.scm index 61dacdcb..870e6ea0 100644 --- a/tw/home/cern.scm +++ b/tw/home/cern.scm @@ -121,6 +121,6 @@ (default-key "C2249BBE5E8761C943A0CFA1B7B3914BF63ACD7C") (gui-pinentry? #t))) - (append %common-services %interactive-services pim-services))))) + (append %common-services (interactive-services) pim-services))))) %cern-home diff --git a/tw/home/lap.scm b/tw/home/lap.scm index 01ba7842..6b7e1516 100644 --- a/tw/home/lap.scm +++ b/tw/home/lap.scm @@ -223,6 +223,8 @@ (default-key "53EC3C06856883DD92355BC22FC78504681F69B0") (gui-pinentry? #t))) - (append pim-services %interactive-services %common-services))))) + (append pim-services + (interactive-services #:nvidia-driver? #t) + %common-services))))) %lap-home -- cgit v1.2.3