summaryrefslogtreecommitdiff
path: root/gnu/home/services
diff options
context:
space:
mode:
author( via Guix-patches via <guix-patches@gnu.org>2022-10-12 21:21:39 +0100
committerAndrew Tropin <andrew@trop.in>2022-10-13 09:05:46 +0400
commit4ab434958b8e97c73e8900ebb48721de11fa3c81 (patch)
tree5efcb87e97f43b04b293cef979b1168b8d952c05 /gnu/home/services
parent4bc5383b3b79b9ee6d42b3a6770d2406035767eb (diff)
gnu: home: Add home-dbus-service-type.
* gnu/home/services/desktop.scm (home-dbus-service-type): New variable. (home-dbus-configuration): New record type. * doc/guix.texi: Document them. Signed-off-by: Andrew Tropin <andrew@trop.in>
Diffstat (limited to 'gnu/home/services')
-rw-r--r--gnu/home/services/desktop.scm54
1 files changed, 53 insertions, 1 deletions
diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
index b0f4d969b0..6549efd8df 100644
--- a/gnu/home/services/desktop.scm
+++ b/gnu/home/services/desktop.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2022 ( <paren@disroot.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -20,6 +21,7 @@
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
#:use-module (gnu services configuration)
+ #:autoload (gnu packages glib) (dbus)
#:autoload (gnu packages xdisorg) (redshift)
#:use-module (guix records)
#:use-module (guix gexp)
@@ -27,8 +29,10 @@
#:use-module (ice-9 match)
#:export (home-redshift-configuration
home-redshift-configuration?
+ home-redshift-service-type
- home-redshift-service-type))
+ home-dbus-configuration
+ home-dbus-service-type))
;;;
@@ -172,3 +176,51 @@ format."))
(description
"Run Redshift, a program that adjusts the color temperature of display
according to time of day.")))
+
+
+;;;
+;;; D-Bus.
+;;;
+
+(define-record-type* <home-dbus-configuration>
+ home-dbus-configuration make-home-dbus-configuration
+ home-dbus-configuration?
+ (dbus home-dbus-dbus ;file-like
+ (default dbus)))
+
+(define (home-dbus-shepherd-services config)
+ (list (shepherd-service
+ (documentation "Run the D-Bus daemon in session-specific mode.")
+ (provision '(dbus))
+ (start #~(make-forkexec-constructor
+ (list #$(file-append (home-dbus-dbus config)
+ "/bin/dbus-daemon")
+ "--nofork" "--session"
+ (format #f "--address=unix:path=~a/bus"
+ (or (getenv "XDG_RUNTIME_DIR")
+ (format #f "/run/user/~a"
+ (getuid)))))
+ #:environment-variables
+ #~(list "DBUS_VERBOSE=1")
+ #:log-file
+ (format #f "~a/dbus.log"
+ (or (getenv "XDG_LOG_HOME")
+ (format #f "~a/.local/var/log"
+ (getenv "HOME"))))))
+ (stop #~(make-kill-destructor)))))
+
+(define (home-dbus-environment-variables config)
+ '(("DBUS_SESSION_BUS_ADDRESS"
+ . "unix:path=${XDG_RUNTIME_DIR:-/run/user/$UID}/bus")))
+
+(define home-dbus-service-type
+ (service-type
+ (name 'home-dbus)
+ (extensions
+ (list (service-extension home-shepherd-service-type
+ home-dbus-shepherd-services)
+ (service-extension home-environment-variables-service-type
+ home-dbus-environment-variables)))
+ (default-value (home-dbus-configuration))
+ (description
+ "Run the session-specific D-Bus inter-process message bus.")))