diff mbox

[2/2] gnu: Add kmscon.

Message ID CAL1_immh-4mrOb5xDz0OJnQhsmBZVQ2BQgL17uTuOEZkOhzSWg@mail.gmail.com
State New
Headers show

Commit Message

David Craven Aug. 22, 2016, 6:14 p.m. UTC
By writing a service ;-) I have a wip I started on a while ago, but I
didn't get past a black screen, so it needs some debugging... Also
it's sadly been abandoned in favor of systemd-console, which is
basically the same thing rewritten by the same author inside the
systemd tree :/

Comments

David Craven Aug. 22, 2016, 6:17 p.m. UTC | #1
I forgot to mention, I think mesa needs some patches for this to work,
there are on the mailing list somewhere as libdrm update, mesa update,
mesa enable wayland flags.
diff mbox

Patch

From 99b3ca3475507d9dc8df085ebb843909876c5a55 Mon Sep 17 00:00:00 2001
From: David Craven <david@craven.ch>
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>
+  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 <shepherd-service> 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