From 99b3ca3475507d9dc8df085ebb843909876c5a55 Mon Sep 17 00:00:00 2001 From: David Craven Date: Wed, 20 Jul 2016 13:17:07 +0200 Subject: [PATCH] wip kmscon service --- gnu/local.mk | 1 + gnu/services/kmscon.scm | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 gnu/services/kmscon.scm diff --git a/gnu/local.mk b/gnu/local.mk index b8c5378..8c6be96 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -382,6 +382,7 @@ GNU_SYSTEM_MODULES = \ %D%/services/dbus.scm \ %D%/services/desktop.scm \ %D%/services/dict.scm \ + %D%/services/kmscon.scm \ %D%/services/lirc.scm \ %D%/services/mail.scm \ %D%/services/mcron.scm \ diff --git a/gnu/services/kmscon.scm b/gnu/services/kmscon.scm new file mode 100644 index 0000000..da1eb2a --- /dev/null +++ b/gnu/services/kmscon.scm @@ -0,0 +1,56 @@ +(define-module (gnu services kmscon) + #:use-module (gnu packages admin) + #:use-module (gnu packages kmscon) + #:use-module (gnu services) + #:use-module (gnu services shepherd) + #:use-module (guix gexp) + #:use-module (guix records) + #:use-module (srfi srfi-26) + #:export (kmscon-service)) + +(define-record-type* + kmscon-configuration make-kmscon-configuration + kmscon-configuration? + (kmscon kmscon-configuration-kmscon) + (login-program kmscon-configuration-login-program) + (login-params kmscon-configuration-login-params) + (hwaccel? kmscon-configuration-hwaccel?)) + +(define (kmscon-shepherd-service config) + "Return a for kmscon with CONFIG." + (define kmscon (kmscon-configuration-kmscon config)) + + (define kmscon-command + (append + (list + #~(string-append #$kmscon "/bin/kmscon") + "--login" (kmscon-configuration-login-program config)) + (if (kmscon-configuration-hwaccel? config) '("--hwaccel") '()) + (list + "--" (kmscon-configuration-login-params config)))) + + (list (shepherd-service + (documentation "kmscon virtual terminal") + (requirement '(user-processes)) + (provision '(kmscon)) + (start #~(make-forkexec-constructor #$@kmscon-command)) + (stop #~(make-kill-destructor))))) + +(define kmscon-service-type + (service-type (name 'kmscon) + (extensions + (list (service-extension shepherd-root-service-type + kmscon-shepherd-service))))) + +(define* (kmscon-service #:key + (kmscon kmscon) + (login-program #~(string-append #$shadow "/bin/login")) + (login-params "-p") + (hwaccel? #t)) + "Run the @command{kmscon} daemon from @var{kmscon} to start a virtual terminal." + (service kmscon-service-type + (kmscon-configuration + (kmscon kmscon) + (login-program login-program) + (login-params login-params) + (hwaccel? hwaccel?)))) -- 2.9.0