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 23:26:08 +0200
committerLudovic Courtès <ludo@gnu.org>2013-09-25 23:26:08 +0200
commitf83e943fe7b7a4db93a6c603b9fdde57a35e918d (patch)
treeb2a23f7519043f0bcb38e1bb1d454d7994b00343 /gnu/system/dmd.scm
parent27cab84c6d598d5bb53bf136d78e7a2b0e8e0269 (diff)
downloadguix-f83e943fe7b7a4db93a6c603b9fdde57a35e918d.tar.gz
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.
Diffstat (limited to 'gnu/system/dmd.scm')
-rw-r--r--gnu/system/dmd.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/gnu/system/dmd.scm b/gnu/system/dmd.scm
index 5bdf7b7a05..7fc4650c25 100644
--- a/gnu/system/dmd.scm
+++ b/gnu/system/dmd.scm
@@ -40,6 +40,8 @@
             syslog-service
             mingetty-service
             guix-service
+            static-networking-service
+
             dmd-configuration-file))
 
 ;;; Commentary:
@@ -131,6 +133,22 @@
      (start `(make-forkexec-constructor ,daemon))
      (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)
   "Return the dmd configuration file for SERVICES."