aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2017-10-31 21:38:21 +0100
committerMarius Bakke <mbakke@fastmail.com>2017-12-29 14:06:26 +0100
commitdb8ed7cee81cbd60b0f8d89a7bee377b369fdac1 (patch)
treea3064b58b63e0403abbea09589e6d72dd5c2547f /gnu
parent5859fd6c9ec14152cc2f342480ff45e29607eebc (diff)
downloadguix-db8ed7cee81cbd60b0f8d89a7bee377b369fdac1.tar.gz
guix-db8ed7cee81cbd60b0f8d89a7bee377b369fdac1.zip
services: networking: Add a dependency override mechanism to <static-networking>.
* gnu/services/networking.scm (<static-networking>)[requirement]: New field. (static-networking-shepherd-service): Don't override requirement for loopback. (static-networking-service): Expose 'requirement' parameter. Default to UDEV. * gnu/services/base.scm (%base-services): Add (requirement '()) for loopback service. * doc/guix.texi (Networking Services): Document it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/base.scm1
-rw-r--r--gnu/services/networking.scm14
2 files changed, 10 insertions, 5 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 7fc8f6aa7e..f4681c804d 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1986,6 +1986,7 @@ This service is not part of @var{%base-services}."
(service static-networking-service-type
(list (static-networking (interface "lo")
(ip "127.0.0.1")
+ (requirement '())
(provision '(loopback)))))
(syslog-service)
(service urandom-seed-service-type)
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index b0c23aafc7..c3ba0787c0 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -5,6 +5,7 @@
;;; Copyright © 2016 John Darrington <jmd@gnu.org>
;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
+;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -51,6 +52,7 @@
static-networking-ip
static-networking-netmask
static-networking-gateway
+ static-networking-requirement
static-networking-service
static-networking-service-type
@@ -145,22 +147,21 @@ fe80::1%lo0 apps.facebook.com\n")
(default #f))
(provision static-networking-provision
(default #f))
+ (requirement static-networking-requirement
+ (default '()))
(name-servers static-networking-name-servers ;FIXME: doesn't belong here
(default '())))
(define static-networking-shepherd-service
(match-lambda
(($ <static-networking> interface ip netmask gateway provision
- name-servers)
+ requirement name-servers)
(let ((loopback? (and provision (memq 'loopback provision))))
(shepherd-service
- ;; Unless we're providing the loopback interface, wait for udev to be up
- ;; and running so that INTERFACE is actually usable.
- (requirement (if loopback? '() '(udev)))
-
(documentation
"Bring up the networking interface using a static IP address.")
+ (requirement requirement)
(provision (or provision
(list (symbol-append 'networking-
(string->symbol interface)))))
@@ -263,6 +264,8 @@ network interface.")))
(define* (static-networking-service interface ip
#:key
netmask gateway provision
+ ;; Most interfaces require udev to be usable.
+ (requirement '(udev))
(name-servers '()))
"Return a service that starts @var{interface} with address @var{ip}. If
@var{netmask} is true, use it as the network mask. If @var{gateway} is true,
@@ -277,6 +280,7 @@ to handle."
(list (static-networking (interface interface) (ip ip)
(netmask netmask) (gateway gateway)
(provision provision)
+ (requirement requirement)
(name-servers name-servers)))))
(define dhcp-client-service-type