gnu: dmd: Add SLiM service.
* gnu/system/dmd.scm (xorg-service): Remove. (xorg-start-command, slim-service): New procedure.
This commit is contained in:
parent
f3d4af173a
commit
06d275f67f
@ -22,9 +22,9 @@
|
|||||||
#:use-module (guix derivations)
|
#:use-module (guix derivations)
|
||||||
#:use-module (guix records)
|
#:use-module (guix records)
|
||||||
#:use-module ((gnu packages base)
|
#:use-module ((gnu packages base)
|
||||||
#:select (glibc-final))
|
#:select (glibc-final guile-final))
|
||||||
#:use-module ((gnu packages admin)
|
#:use-module ((gnu packages admin)
|
||||||
#:select (mingetty inetutils shadow))
|
#:select (dmd mingetty inetutils shadow))
|
||||||
#:use-module ((gnu packages package-management)
|
#:use-module ((gnu packages package-management)
|
||||||
#:select (guix))
|
#:select (guix))
|
||||||
#:use-module ((gnu packages linux)
|
#:use-module ((gnu packages linux)
|
||||||
@ -32,6 +32,8 @@
|
|||||||
#:use-module (gnu packages xorg)
|
#:use-module (gnu packages xorg)
|
||||||
#:use-module (gnu packages bash)
|
#:use-module (gnu packages bash)
|
||||||
#:use-module (gnu packages gl)
|
#:use-module (gnu packages gl)
|
||||||
|
#:use-module (gnu packages slim)
|
||||||
|
#:use-module (gnu packages ratpoison)
|
||||||
|
|
||||||
#:use-module (gnu system shadow) ; for user accounts/groups
|
#:use-module (gnu system shadow) ; for user accounts/groups
|
||||||
#:use-module (gnu system linux) ; for PAM services
|
#:use-module (gnu system linux) ; for PAM services
|
||||||
@ -58,7 +60,8 @@
|
|||||||
nscd-service
|
nscd-service
|
||||||
guix-service
|
guix-service
|
||||||
static-networking-service
|
static-networking-service
|
||||||
xorg-service
|
xorg-start-command
|
||||||
|
slim-service
|
||||||
|
|
||||||
dmd-configuration-file))
|
dmd-configuration-file))
|
||||||
|
|
||||||
@ -270,8 +273,12 @@ true, it must be a string specifying the default network gateway."
|
|||||||
`(("net-tools" ,net-tools))
|
`(("net-tools" ,net-tools))
|
||||||
'())))))))
|
'())))))))
|
||||||
|
|
||||||
(define (xorg-service)
|
(define* (xorg-start-command #:key
|
||||||
"Return a service that starts the Xorg graphical display server."
|
(guile guile-final)
|
||||||
|
(xorg-server xorg-server))
|
||||||
|
"Return a derivation that builds a GUILE script to start the X server from
|
||||||
|
XORG-SERVER. Usually the X server is started by a login manager."
|
||||||
|
|
||||||
(define (xserver.conf)
|
(define (xserver.conf)
|
||||||
(text-file* "xserver.conf" "
|
(text-file* "xserver.conf" "
|
||||||
Section \"Files\"
|
Section \"Files\"
|
||||||
@ -314,36 +321,103 @@ Section \"Screen\"
|
|||||||
Device \"Device-vesa\"
|
Device \"Device-vesa\"
|
||||||
EndSection"))
|
EndSection"))
|
||||||
|
|
||||||
(mlet %store-monad ((xorg-bin (package-file xorg-server "bin/X"))
|
(mlet %store-monad ((guile-bin (package-file guile "bin/guile"))
|
||||||
|
(xorg-bin (package-file xorg-server "bin/X"))
|
||||||
(dri (package-file mesa "lib/dri"))
|
(dri (package-file mesa "lib/dri"))
|
||||||
(xkbcomp-bin (package-file xkbcomp "bin"))
|
(xkbcomp-bin (package-file xkbcomp "bin"))
|
||||||
(xkb-dir (package-file xkeyboard-config
|
(xkb-dir (package-file xkeyboard-config
|
||||||
"share/X11/xkb"))
|
"share/X11/xkb"))
|
||||||
(sh (package-file bash "bin/sh"))
|
|
||||||
(config (xserver.conf)))
|
(config (xserver.conf)))
|
||||||
|
(define builder
|
||||||
|
;; 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))))
|
||||||
|
|
||||||
|
(define* (slim-service #:key (slim slim)
|
||||||
|
(allow-empty-passwords? #t) auto-login?
|
||||||
|
(default-user "")
|
||||||
|
(xauth xauth) (dmd dmd) (bash bash)
|
||||||
|
startx)
|
||||||
|
"Return a service that spawns the SLiM graphical login manager, which in
|
||||||
|
turn start the X display server with STARTX, a command as returned by
|
||||||
|
'xorg-start-command'.
|
||||||
|
|
||||||
|
When ALLOW-EMPTY-PASSWORDS? is true, allow logins with an empty password.
|
||||||
|
When AUTO-LOGIN? is true, log in automatically as DEFAULT-USER."
|
||||||
|
(define (slim.cfg)
|
||||||
|
;; TODO: Run "bash -login ~/.xinitrc %session".
|
||||||
|
(mlet %store-monad ((startx (or startx (xorg-start-command))))
|
||||||
|
(text-file* "slim.cfg" "
|
||||||
|
default_path /run/current-system/bin
|
||||||
|
default_xserver " startx "
|
||||||
|
xserver_arguments :0 vt7
|
||||||
|
xauth_path " xauth "/bin/xauth
|
||||||
|
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 " ratpoison "/bin/ratpoison
|
||||||
|
|
||||||
|
halt_cmd " dmd "/sbin/halt
|
||||||
|
reboot_cmd " dmd "/sbin/reboot
|
||||||
|
" (if auto-login?
|
||||||
|
(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)))
|
||||||
(return
|
(return
|
||||||
(service
|
(service
|
||||||
(documentation "The X11 graphic server")
|
(documentation "Xorg display server")
|
||||||
(provision '(xorg-server))
|
(provision '(xorg-server))
|
||||||
(requirement '(host-name))
|
(requirement '(host-name))
|
||||||
(start `(make-forkexec-constructor
|
(start
|
||||||
;; XXX: 'make-forkexec-constructor' should allow use to specify
|
;; XXX: Work around the inability to specify env. vars. directly.
|
||||||
;; env vars.
|
`(make-forkexec-constructor
|
||||||
,sh "-c" ,(string-append "XORG_DRI_DRIVER_PATH=" dri " "
|
,bash-bin "-c"
|
||||||
"XKB_BINDIR=" xkbcomp-bin " "
|
,(string-append "SLIM_CFGFILE=" (derivation->output-path slim.cfg)
|
||||||
xorg-bin " -ac -logverbose -verbose "
|
" " slim-bin
|
||||||
"-xkbdir " xkb-dir " "
|
" -nodaemon")))
|
||||||
"-config "
|
|
||||||
(derivation->output-path config) " "
|
|
||||||
"-nolisten tcp :0 vt7")))
|
|
||||||
(stop `(make-kill-destructor))
|
(stop `(make-kill-destructor))
|
||||||
(respawn? #f)
|
(inputs `(("slim" ,slim)
|
||||||
(inputs `(("xorg" ,xorg-server)
|
("slim.cfg" ,slim.cfg)
|
||||||
("xkbcomp" ,xkbcomp)
|
("bash" ,bash)))
|
||||||
("xkeyboard-config" ,xkeyboard-config)
|
(respawn? #t)
|
||||||
("mesa" ,mesa)
|
(pam-services
|
||||||
("bash" ,bash)
|
;; Tell PAM about 'slim'.
|
||||||
("xorg.conf" ,config)))))))
|
(list (unix-pam-service
|
||||||
|
"slim"
|
||||||
|
#:allow-empty-passwords? allow-empty-passwords?)))))))
|
||||||
|
|
||||||
|
|
||||||
(define (dmd-configuration-file services etc)
|
(define (dmd-configuration-file services etc)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user