summary refs log tree commit diff
path: root/gnu/system/dmd.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-09-25 21:49:22 +0200
committerLudovic Courtès <ludo@gnu.org>2013-09-25 21:49:22 +0200
commitba47851fac503f005d2bc496161638c46cc29ffc (patch)
tree656a7a497f09d040b1a2705a246d6afe4216f285 /gnu/system/dmd.scm
parent43a2779876c5ae170f3c6edc7f3d605997c4ec05 (diff)
downloadguix-ba47851fac503f005d2bc496161638c46cc29ffc.tar.gz
gnu: vm: Add 'host-name' service.
* gnu/system/dmd.scm (host-name-service): New procedure.
  (mingetty-service): Require the 'host-name' service.
* gnu/system/vm.scm (system-qemu-image): Add the 'host-name' service.
  Set PS1 in /etc/bashrc to something sensible.
Diffstat (limited to 'gnu/system/dmd.scm')
-rw-r--r--gnu/system/dmd.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/gnu/system/dmd.scm b/gnu/system/dmd.scm
index a502c42e03..5bdf7b7a05 100644
--- a/gnu/system/dmd.scm
+++ b/gnu/system/dmd.scm
@@ -36,6 +36,7 @@
             service-stop
             service-inputs
 
+            host-name-service
             syslog-service
             mingetty-service
             guix-service
@@ -61,6 +62,14 @@
   (inputs        service-inputs                   ; list of inputs
                  (default '())))
 
+(define (host-name-service store name)
+  "Return a service that sets the host name to NAME."
+  (service
+   (provision '(host-name))
+   (start `(lambda _
+             (sethostname ,name)))
+   (respawn? #f)))
+
 (define (mingetty-service store tty)
   "Return a service to run mingetty on TTY."
   (let* ((mingetty-drv (package-derivation store mingetty))
@@ -68,6 +77,11 @@
                                       "/sbin/mingetty")))
     (service
      (provision (list (symbol-append 'term- (string->symbol tty))))
+
+     ;; Since the login prompt shows the host name, wait for the 'host-name'
+     ;; service to be done.
+     (requirement '(host-name))
+
      (start `(make-forkexec-constructor ,mingetty-bin "--noclear" ,tty))
      (inputs `(("mingetty" ,mingetty))))))