summary refs log tree commit diff
diff options
context:
space:
mode:
authorTimothy Sample <samplet@ngyro.com>2019-05-08 09:13:14 -0400
committerTimothy Sample <samplet@ngyro.com>2019-05-11 13:41:34 -0400
commitdcb3a0fe0a086b4762a721e9b1da64826d5160d0 (patch)
tree847171d21731351f721d1cdb7e87721cfcd64078
parentc087a90e06d7b9451f802323e24deb1862a21e0f (diff)
downloadguix-dcb3a0fe0a086b4762a721e9b1da64826d5160d0.tar.gz
services: gdm: Include user profile in D-Bus paths.
This partially addresses <https://bugs.gnu.org/35267>.

* gnu/services/xorg.scm (dbus-daemon-wrapper): When available, include
directories from '~/.guix-profile' in the search paths of the D-Bus
daemon.
-rw-r--r--gnu/services/xorg.scm40
1 files changed, 32 insertions, 8 deletions
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 3a9fa53d29..0a38b4013c 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -774,14 +774,38 @@ the GNOME desktop environment.")
          (shell (file-append shadow "/sbin/nologin")))))
 
 (define dbus-daemon-wrapper
-  (program-file "gdm-dbus-wrapper"
-                #~(begin
-                    (setenv "XDG_CONFIG_DIRS"
-                            "/run/current-system/profile/etc/xdg")
-                    (setenv "XDG_DATA_DIRS"
-                            "/run/current-system/profile/share")
-                    (apply execl (string-append #$dbus "/bin/dbus-daemon")
-                           (program-arguments)))))
+  (program-file
+   "gdm-dbus-wrapper"
+   #~(begin
+       (use-modules (srfi srfi-26))
+
+       (define system-profile
+         "/run/current-system/profile")
+
+       (define user-profile
+         (and=> (getpw (getuid))
+                (lambda (pw)
+                  (string-append (passwd:dir pw) "/.guix-profile"))))
+
+       ;; If we are able to find the user's profile, we can add it to
+       ;; the search paths set below.  We need to do this so that D-Bus
+       ;; can start services installed by the user.  This allows
+       ;; applications that require session D-Bus services (e.g,
+       ;; 'evolution') to work even if those services are only available
+       ;; in the user's profile.  See <https://bugs.gnu.org/35267>.
+       (define profiles
+         (if user-profile
+             (list user-profile system-profile)
+             (list system-profile)))
+
+       (setenv "XDG_CONFIG_DIRS"
+               (string-join (map (cut string-append <> "/etc/xdg") profiles)
+                            ":"))
+       (setenv "XDG_DATA_DIRS"
+               (string-join (map (cut string-append <> "/share") profiles)
+                            ":"))
+       (apply execl (string-append #$dbus "/bin/dbus-daemon")
+              (program-arguments)))))
 
 (define-record-type* <gdm-configuration>
   gdm-configuration make-gdm-configuration