Tom Willemse
9363fb88cf
The herbstluftwm configuration isn't complete yet, it's only the package so far, but it does extend the xsession service to include a line in xsession to execute the window manager in a bit of a hacky way. This also adds a ‘mixed-executable-file’ function which is the same as the ‘mixed-text-file’ except that it also sets the executable bit for the computed file.
64 lines
2.1 KiB
Scheme
64 lines
2.1 KiB
Scheme
(define-module (oni home services xsession)
|
|
#:use-module (gnu services configuration)
|
|
#:use-module (gnu home services)
|
|
#:use-module (gnu home services utils)
|
|
#:use-module (guix packages)
|
|
#:use-module (guix gexp)
|
|
#:use-module (srfi srfi-1)
|
|
|
|
#:export (home-xsession-service-type
|
|
home-xsession-configuration
|
|
home-xsession-extension))
|
|
|
|
(define-configuration home-xsession-configuration
|
|
(configuration
|
|
(text-config '())
|
|
"Configuration"))
|
|
|
|
(define-configuration/no-serialization home-xsession-extension
|
|
(wm
|
|
(text-config '())
|
|
"String"))
|
|
|
|
(define* (mixed-executable-file name #:key guile #:rest text)
|
|
"Return an object representing store file NAME containing TEXT. TEXT is a
|
|
sequence of strings and file-like objects, as in:
|
|
|
|
(mixed-text-file \"profile\"
|
|
\"export PATH=\" coreutils \"/bin:\" grep \"/bin\")
|
|
|
|
This is the declarative counterpart of 'text-file*'."
|
|
(define build
|
|
(let ((text (if guile (drop text 2) text)))
|
|
(gexp (call-with-output-file (ungexp output "out")
|
|
(lambda (port)
|
|
(set-port-encoding! port "UTF-8")
|
|
(display (string-append (ungexp-splicing text)) port)
|
|
(chmod port #o555))))))
|
|
|
|
(computed-file name build #:guile guile))
|
|
|
|
(define (xsession-home-files config)
|
|
`((".xsession"
|
|
,(mixed-executable-file
|
|
"xsession"
|
|
(serialize-text-config 'configuration (home-xsession-configuration-configuration config))))))
|
|
|
|
(define (home-xsession-extensions original-config extension-configs)
|
|
(home-xsession-configuration
|
|
(inherit original-config)
|
|
(configuration
|
|
(append (home-xsession-configuration-configuration original-config)
|
|
(home-xsession-extension-wm (last extension-configs))))))
|
|
|
|
(define home-xsession-service-type
|
|
(service-type
|
|
(name 'home-xsession)
|
|
(extensions
|
|
(list (service-extension
|
|
home-files-service-type
|
|
xsession-home-files)))
|
|
(compose identity)
|
|
(extend home-xsession-extensions)
|
|
(default-value (home-xsession-configuration))
|
|
(description "Configure xsession.")))
|