summaryrefslogtreecommitdiff
path: root/johnlepikhin/home/dbus.scm
blob: 76099887712120c0921900b89cd9a7cf0ddfbf1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
;; Imported from https://git.sr.ht/~krevedkokun/guix-channel

(define-module (johnlepikhin home dbus)
  #:use-module (gnu home services)
  #:use-module (gnu home services shepherd)
  #:use-module (guix gexp))

(define (home-dbus-environment-variables-service _)
  '(("DBUS_SESSION_BUS_ADDRESS" . "unix:path=$XDG_RUNTIME_DIR/dbus.sock")))

(define (home-dbus-shepherd-service _)
  (list
   (shepherd-service
    (provision '(dbus))
    (stop  #~(make-kill-destructor))
    (start #~(make-forkexec-constructor
              (list #$(file-append (@@ (gnu packages glib) dbus)
                                   "/bin/dbus-daemon")
                    "--nofork"
                    "--session"
                    (string-append
                     "--address=" "unix:path="
                     (getenv "XDG_RUNTIME_DIR") "/dbus.sock")))))))

(define-public home-dbus-service-type
  (service-type
   (name 'home-dbus)
   (extensions
    (list (service-extension
           home-environment-variables-service-type
           home-dbus-environment-variables-service)
          (service-extension
           home-shepherd-service-type
           home-dbus-shepherd-service)))
   (default-value #f)
   (description "run dbus")))