gnu: vm: Add 'networking' service.
* gnu/system/vm.scm (system-qemu-image): Use 'static-networking-service'. Add /etc/resolv.conf. Add Inetutils to the profile. * gnu/system/dmd.scm (static-networking-service): New procedure.
This commit is contained in:
parent
27cab84c6d
commit
f83e943fe7
|
@ -40,6 +40,8 @@
|
||||||
syslog-service
|
syslog-service
|
||||||
mingetty-service
|
mingetty-service
|
||||||
guix-service
|
guix-service
|
||||||
|
static-networking-service
|
||||||
|
|
||||||
dmd-configuration-file))
|
dmd-configuration-file))
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
@ -131,6 +133,22 @@
|
||||||
(start `(make-forkexec-constructor ,daemon))
|
(start `(make-forkexec-constructor ,daemon))
|
||||||
(inputs `(("guix" ,guix))))))
|
(inputs `(("guix" ,guix))))))
|
||||||
|
|
||||||
|
(define* (static-networking-service store interface ip
|
||||||
|
#:key (inetutils inetutils))
|
||||||
|
"Return a service that starts INTERFACE with address IP."
|
||||||
|
|
||||||
|
;; TODO: Eventually we should do this using Guile's networking procedures,
|
||||||
|
;; like 'configure-qemu-networking' does, but the patch that does this is
|
||||||
|
;; not yet in stock Guile.
|
||||||
|
(let ((ifconfig (string-append (package-output store inetutils)
|
||||||
|
"/bin/ifconfig")))
|
||||||
|
(service
|
||||||
|
(provision '(networking))
|
||||||
|
(start `(make-forkexec-constructor ,ifconfig ,interface ,ip "up"))
|
||||||
|
(stop `(make-forkexec-constructor ,ifconfig ,interface "down"))
|
||||||
|
(respawn? #f)
|
||||||
|
(inputs `(("inetutils" ,inetutils))))))
|
||||||
|
|
||||||
|
|
||||||
(define (dmd-configuration-file store services)
|
(define (dmd-configuration-file store services)
|
||||||
"Return the dmd configuration file for SERVICES."
|
"Return the dmd configuration file for SERVICES."
|
||||||
|
|
|
@ -455,7 +455,15 @@ Happy birthday, GNU! http://www.gnu.org/gnu30
|
||||||
(mingetty-service store "tty5")
|
(mingetty-service store "tty5")
|
||||||
(mingetty-service store "tty6")
|
(mingetty-service store "tty6")
|
||||||
(syslog-service store)
|
(syslog-service store)
|
||||||
(guix-service store #:guix guix-0.4)))
|
(guix-service store #:guix guix-0.4)
|
||||||
|
|
||||||
|
;; QEMU networking settings.
|
||||||
|
(static-networking-service store "eth0" "10.0.2.10")))
|
||||||
|
|
||||||
|
(define resolv.conf
|
||||||
|
;; Name resolution for default QEMU settings.
|
||||||
|
(add-text-to-store store "resolv.conf"
|
||||||
|
"nameserver 10.0.2.3\n"))
|
||||||
|
|
||||||
(parameterize ((%guile-for-build (package-derivation store guile-final)))
|
(parameterize ((%guile-for-build (package-derivation store guile-final)))
|
||||||
(let* ((bash-drv (package-derivation store bash))
|
(let* ((bash-drv (package-derivation store bash))
|
||||||
|
@ -480,6 +488,7 @@ Happy birthday, GNU! http://www.gnu.org/gnu30
|
||||||
("dmd" ,dmd)
|
("dmd" ,dmd)
|
||||||
("gcc" ,gcc-final)
|
("gcc" ,gcc-final)
|
||||||
("libc" ,glibc-final)
|
("libc" ,glibc-final)
|
||||||
|
("inetutils" ,inetutils)
|
||||||
("guix" ,guix-0.4)))
|
("guix" ,guix-0.4)))
|
||||||
|
|
||||||
;; TODO: Replace with a real profile with a manifest.
|
;; TODO: Replace with a real profile with a manifest.
|
||||||
|
@ -514,6 +523,7 @@ You can log in as 'root' with no password.
|
||||||
("/etc/passwd" -> ,passwd)
|
("/etc/passwd" -> ,passwd)
|
||||||
("/etc/login.defs" -> "/dev/null")
|
("/etc/login.defs" -> "/dev/null")
|
||||||
("/etc/pam.d" -> ,pam.d)
|
("/etc/pam.d" -> ,pam.d)
|
||||||
|
("/etc/resolv.conf" -> ,resolv.conf)
|
||||||
("/etc/profile" -> ,bashrc)
|
("/etc/profile" -> ,bashrc)
|
||||||
("/etc/issue" -> ,issue)
|
("/etc/issue" -> ,issue)
|
||||||
(directory "/var/nix/gcroots")
|
(directory "/var/nix/gcroots")
|
||||||
|
@ -552,6 +562,7 @@ You can log in as 'root' with no password.
|
||||||
("etc-passwd" ,passwd)
|
("etc-passwd" ,passwd)
|
||||||
("etc-shadow" ,shadow)
|
("etc-shadow" ,shadow)
|
||||||
("etc-group" ,group)
|
("etc-group" ,group)
|
||||||
|
("etc-resolv.conf" ,resolv.conf)
|
||||||
("etc-bashrc" ,bashrc)
|
("etc-bashrc" ,bashrc)
|
||||||
("etc-issue" ,issue)
|
("etc-issue" ,issue)
|
||||||
("etc-motd" ,motd)
|
("etc-motd" ,motd)
|
||||||
|
|
Loading…
Reference in New Issue