1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (gnu services hurd)
20 #:use-module (gnu packages admin)
21 #:use-module (gnu packages hurd)
22 #:use-module (gnu services)
23 #:use-module (gnu services shepherd)
24 #:use-module (gnu system)
25 #:use-module (guix gexp)
26 #:use-module (guix records)
27 #:export (hurd-console-configuration
28 hurd-console-service-type
29 hurd-getty-configuration
30 hurd-getty-service-type))
34 ;;; This module implements services for the Hurd.
39 ;;; The Hurd VGA console service.
42 (define-record-type* <hurd-console-configuration>
43 hurd-console-configuration make-hurd-console-configuration
44 hurd-console-configuration?
45 (hurd hurd-console-configuration-hurd ;package
48 (define (hurd-console-shepherd-service config)
49 "Return a <shepherd-service> for a Hurd VGA console with CONFIG."
51 (define console-command
53 (string-append #$(hurd-console-configuration-hurd config) "/bin/console")
57 "-d" "generic_speaker"))
59 (list (shepherd-service
60 (documentation "Run the Hurd’s VGA console client.")
61 (provision '(console))
62 (requirement '(user-processes))
63 (start #~(make-forkexec-constructor #$console-command))
64 (stop #~(make-kill-destructor)))))
66 (define hurd-console-service-type
69 (description "Run the Hurd console client.")
71 (list (service-extension shepherd-root-service-type
72 hurd-console-shepherd-service)))
73 (default-value (hurd-console-configuration))))
77 ;;; The Hurd getty service.
80 (define-record-type* <hurd-getty-configuration>
81 hurd-getty-configuration make-hurd-getty-configuration
82 hurd-getty-configuration?
83 (hurd hurd-getty-configuration-hurd ;<package>
85 (tty hurd-getty-configuration-tty) ;string
86 (baud-rate hurd-getty-configuration-baud-rate
87 (default 38400))) ;integer
89 (define (hurd-getty-shepherd-service config)
90 "Return a <shepherd-service> for a Hurd getty with CONFIG."
92 (let ((hurd (hurd-getty-configuration-hurd config))
93 (tty (hurd-getty-configuration-tty config))
94 (baud-rate (hurd-getty-configuration-baud-rate config)))
98 (string-append #$hurd "/libexec/getty")
99 #$(number->string baud-rate)
104 (documentation "Run getty on a tty.")
105 (provision (list (string->symbol (string-append "term-" tty))))
106 (requirement '(user-processes console))
107 (start #~(make-forkexec-constructor #$getty-command))
108 (stop #~(make-kill-destructor))))))
110 (define hurd-getty-service-type
113 (extensions (list (service-extension shepherd-root-service-type
114 hurd-getty-shepherd-service)))
116 "Provide console login using the Hurd @command{getty} program.")))
118 ;;; hurd.scm ends here