From ba47851fac503f005d2bc496161638c46cc29ffc Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 25 Sep 2013 21:49:22 +0200 Subject: 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. --- gnu/system/dmd.scm | 14 ++++++++++++++ gnu/system/vm.scm | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) 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 @@ (define-module (gnu system dmd) service-stop service-inputs + host-name-service syslog-service mingetty-service guix-service @@ -61,6 +62,14 @@ (define-record-type* (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 @@ (define (mingetty-service store tty) "/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)))))) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index e79a4257de..0cab3ced17 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -447,7 +447,8 @@ (define %pam-services (define %dmd-services ;; Services run by dmd. - (list (mingetty-service store "tty1") + (list (host-name-service store "gnu") + (mingetty-service store "tty1") (mingetty-service store "tty2") (mingetty-service store "tty3") (mingetty-service store "tty4") @@ -488,6 +489,7 @@ (define %dmd-services (profile (derivation->output-path profile-drv)) (bashrc (add-text-to-store store "bashrc" (string-append " +export PS1='\\u@\\h\\$ ' export PATH=$HOME/.guix-profile/bin:" profile "/bin:" profile "/sbin export CPATH=$HOME/.guix-profile/include:" profile "/include export LIBRARY_PATH=$HOME/.guix-profile/lib:" profile "/lib -- cgit v1.2.3