summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorDavid Craven <david@craven.ch>2016-07-20 13:17:07 +0200
committerDavid Craven <david@craven.ch>2016-09-11 16:29:45 +0200
commit46ec2707a459f376dd72ea6e545662f51157c95e (patch)
tree67be727ec3410e67277253abbb72ef25b0e26a9a /gnu
parent317d3b474ab5e0e62509dd1b5b2fbbf2e27c95fe (diff)
downloadpatches-46ec2707a459f376dd72ea6e545662f51157c95e.tar
patches-46ec2707a459f376dd72ea6e545662f51157c95e.tar.gz
services: Add kmscon service.
* gnu/services/base.scm (<kmscon-configuration>, kmscon-service-type): New variables. * doc/guix.texi (@deffn kmscon-service-type, @deftp kmscon-configuration): Add documentation.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/base.scm43
1 files changed, 43 insertions, 0 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 20a9c3ae11..4c1c481453 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -39,6 +39,7 @@
#:use-module (gnu packages package-management)
#:use-module (gnu packages ssh)
#:use-module (gnu packages lsof)
+ #:use-module (gnu packages terminals)
#:use-module ((gnu build file-systems)
#:select (mount-flags->bit-mask))
#:use-module (guix gexp)
@@ -116,6 +117,11 @@
rngd-configuration?
rngd-service-type
rngd-service
+
+ kmscon-configuration
+ kmscon-configuration?
+ kmscon-service-type
+
pam-limits-service-type
pam-limits-service
@@ -1449,6 +1455,43 @@ This service is not part of @var{%base-services}."
(service gpm-service-type
(gpm-configuration (gpm gpm) (options options))))
+(define-record-type* <kmscon-configuration>
+ kmscon-configuration make-kmscon-configuration
+ kmscon-configuration?
+ (kmscon kmscon-configuration-kmscon
+ (default kmscon))
+ (virtual-terminal kmscon-configuration-virtual-terminal)
+ (login-program kmscon-configuration-login-program
+ (default #~(string-append #$shadow "/bin/login")))
+ (login-arguments kmscon-configuration-login-arguments
+ (default '("-p")))
+ (hardware-acceleration? kmscon-configuration-hardware-acceleration?
+ (default #f))) ; #t causes failure
+
+(define kmscon-service-type
+ (shepherd-service-type
+ 'kmscon
+ (lambda (config)
+ (let ((kmscon (kmscon-configuration-kmscon config))
+ (virtual-terminal (kmscon-configuration-virtual-terminal config))
+ (login-program (kmscon-configuration-login-program config))
+ (login-arguments (kmscon-configuration-login-arguments config))
+ (hardware-acceleration? (kmscon-configuration-hardware-acceleration? config)))
+
+ (define kmscon-command
+ #~(list
+ (string-append #$kmscon "/bin/kmscon") "--login"
+ "--vt" #$virtual-terminal
+ #$@(if hardware-acceleration? '("--hwaccel") '())
+ "--" #$login-program #$@login-arguments))
+
+ (shepherd-service
+ (documentation "kmscon virtual terminal")
+ (requirement '(user-processes udev dbus-system))
+ (provision (list (symbol-append 'term- (string->symbol virtual-terminal))))
+ (start #~(make-forkexec-constructor #$kmscon-command))
+ (stop #~(make-kill-destructor)))))))
+
(define %base-services
;; Convenience variable holding the basic services.