summary refs log tree commit diff
path: root/gnu/services/xorg.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/services/xorg.scm')
-rw-r--r--gnu/services/xorg.scm118
1 files changed, 39 insertions, 79 deletions
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 086150a658..7215297f69 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -27,6 +27,7 @@
   #:use-module (gnu packages gnustep)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages bash)
+  #:use-module (guix gexp)
   #:use-module (guix monads)
   #:use-module (guix derivations)
   #:export (xorg-start-command
@@ -86,77 +87,42 @@ Section \"Screen\"
   Device \"Device-vesa\"
 EndSection"))
 
-  (mlet %store-monad ((guile-bin   (package-file guile "bin/guile"))
-                      (xorg-bin    (package-file xorg-server "bin/X"))
-                      (dri         (package-file mesa "lib/dri"))
-                      (xkbcomp-bin (package-file xkbcomp "bin"))
-                      (xkb-dir     (package-file xkeyboard-config
-                                                 "share/X11/xkb"))
-                      (config      (xserver.conf)))
-    (define builder
+  (mlet %store-monad ((config (xserver.conf)))
+    (define script
       ;; Write a small wrapper around the X server.
-      `(let ((out (assoc-ref %outputs "out")))
-         (call-with-output-file out
-           (lambda (port)
-             (format port "#!~a --no-auto-compile~%!#~%" ,guile-bin)
-             (write '(begin
-                       (setenv "XORG_DRI_DRIVER_PATH" ,dri)
-                       (setenv "XKB_BINDIR" ,xkbcomp-bin)
-
-                       (apply execl
-
-                              ,xorg-bin "-ac" "-logverbose" "-verbose"
-                              "-xkbdir" ,xkb-dir
-                              "-config" ,(derivation->output-path config)
-                              "-nolisten" "tcp" "-terminate"
-
-                              ;; Note: SLiM and other display managers add the
-                              ;; '-auth' flag by themselves.
-                              (cdr (command-line))))
-                    port)))
-         (chmod out #o555)
-         #t))
-
-    (mlet %store-monad ((inputs (lower-inputs
-                                 `(("xorg" ,xorg-server)
-                                   ("xkbcomp" ,xkbcomp)
-                                   ("xkeyboard-config" ,xkeyboard-config)
-                                   ("mesa" ,mesa)
-                                   ("guile" ,guile)
-                                   ("xorg.conf" ,config)))))
-      (derivation-expression "start-xorg" builder
-                             #:inputs inputs))))
+      #~(begin
+          (setenv "XORG_DRI_DRIVER_PATH" (string-append #$mesa "/lib/dri"))
+          (setenv "XKB_BINDIR" (string-append #$xkbcomp "/bin"))
+
+          (apply execl (string-append #$xorg-server "/bin/X")
+                 "-ac" "-logverbose" "-verbose"
+                 "-xkbdir" (string-append #$xkeyboard-config "/share/X11/xkb")
+                 "-config" #$config
+                 "-nolisten" "tcp" "-terminate"
+
+                 ;; Note: SLiM and other display managers add the
+                 ;; '-auth' flag by themselves.
+                 (cdr (command-line)))))
+
+    (gexp->script "start-xorg" script)))
 
 (define* (xinitrc #:key
                   (guile guile-final)
                   (ratpoison ratpoison)
                   (windowmaker windowmaker))
   "Return a system-wide xinitrc script that starts the specified X session."
-  (mlet %store-monad ((guile-bin     (package-file guile "bin/guile"))
-                      (ratpoison-bin (package-file ratpoison "bin/ratpoison"))
-                      (wmaker-bin    (package-file windowmaker "bin/wmaker"))
-                      (inputs        (lower-inputs
-                                      `(("raptoison" ,ratpoison)
-                                        ("wmaker" ,windowmaker)))))
-    (define builder
-      `(let ((out (assoc-ref %outputs "out")))
-         (call-with-output-file out
-           (lambda (port)
-             (format port "#!~a --no-auto-compile~%!#~%" ,guile-bin)
-             (write '(begin
-                       (use-modules (ice-9 match))
-
-                       ;; TODO: Check for ~/.xsession.
-                       (match (command-line)
-                         ((_ "ratpoison")
-                          (execl ,ratpoison-bin))
-                         (_
-                          (execl ,wmaker-bin))))
-                    port)))
-         (chmod out #o555)
-         #t))
-
-    (derivation-expression "xinitrc" builder #:inputs inputs)))
+  (define builder
+    #~(begin
+        (use-modules (ice-9 match))
+
+        ;; TODO: Check for ~/.xsession.
+        (match (command-line)
+          ((_ "ratpoison")
+           (execl (string-append #$ratpoison "/bin/ratpoison")))
+          (_
+           (execl (string-append #$windowmaker "/bin/wmaker"))))))
+
+  (gexp->script "xinitrc" builder))
 
 (define* (slim-service #:key (slim slim)
                        (allow-empty-passwords? #t) auto-login?
@@ -173,7 +139,7 @@ When AUTO-LOGIN? is true, log in automatically as DEFAULT-USER."
     (mlet %store-monad ((startx  (or startx (xorg-start-command)))
                         (xinitrc (xinitrc)))
       (text-file* "slim.cfg"  "
-default_path /run/current-system/bin
+default_path /run/current-system/profile/bin
 default_xserver " startx "
 xserver_arguments :0 vt7
 xauth_path " xauth "/bin/xauth
@@ -181,7 +147,7 @@ authfile /var/run/slim.auth
 
 # The login command.  '%session' is replaced by the chosen session name, one
 # of the names specified in the 'sessions' setting: 'wmaker', 'xfce', etc.
-login_cmd  exec " xinitrc "%session
+login_cmd  exec " xinitrc " %session
 sessions   wmaker,ratpoison
 
 halt_cmd " dmd "/sbin/halt
@@ -190,25 +156,19 @@ reboot_cmd " dmd "/sbin/reboot
       (string-append "auto_login yes\ndefault_user " default-user)
       ""))))
 
-  (mlet %store-monad ((slim-bin (package-file slim "bin/slim"))
-                      (bash-bin (package-file bash "bin/bash"))
-                      (slim.cfg (slim.cfg)))
+  (mlet %store-monad ((slim.cfg (slim.cfg)))
     (return
      (service
       (documentation "Xorg display server")
       (provision '(xorg-server))
-      (requirement '(host-name))
+      (requirement '(user-processes host-name))
       (start
        ;; XXX: Work around the inability to specify env. vars. directly.
-       `(make-forkexec-constructor
-         ,bash-bin "-c"
-         ,(string-append "SLIM_CFGFILE=" (derivation->output-path slim.cfg)
-                         " " slim-bin
-                         " -nodaemon")))
-      (stop  `(make-kill-destructor))
-      (inputs `(("slim" ,slim)
-                ("slim.cfg" ,slim.cfg)
-                ("bash" ,bash)))
+       #~(make-forkexec-constructor
+          (string-append #$bash "/bin/sh") "-c"
+          (string-append "SLIM_CFGFILE=" #$slim.cfg
+                         " " #$slim "/bin/slim" " -nodaemon")))
+      (stop #~(make-kill-destructor))
       (respawn? #t)
       (pam-services
        ;; Tell PAM about 'slim'.