aboutsummaryrefslogtreecommitdiff
path: root/gnu/services/networking.scm
diff options
context:
space:
mode:
author宋文武 <iyzsong@gmail.com>2015-11-16 13:56:24 +0800
committer宋文武 <iyzsong@gmail.com>2015-11-26 13:50:13 +0800
commit7234ad4f549066ebda7c28a492042833ba1cf723 (patch)
treeaa9183f022a89eb924836de5dacb9dff28fae145 /gnu/services/networking.scm
parentbde2171d4daa09e86efc3352a9cc20def8dd9ac8 (diff)
downloadpatches-7234ad4f549066ebda7c28a492042833ba1cf723.tar
patches-7234ad4f549066ebda7c28a492042833ba1cf723.tar.gz
services: Add network-manager-service.
* gnu/services/networking.scm (network-manager-service): New procedure. (network-manager-service-type, %network-manager-activation): New variables. (network-manager-dmd-service): New procedure.
Diffstat (limited to 'gnu/services/networking.scm')
-rw-r--r--gnu/services/networking.scm43
1 files changed, 42 insertions, 1 deletions
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index a09714447e..0bbacab1ad 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -29,6 +29,7 @@
#:use-module (gnu packages messaging)
#:use-module (gnu packages ntp)
#:use-module (gnu packages wicd)
+ #:use-module (gnu packages gnome)
#:use-module (guix gexp)
#:use-module (guix records)
#:use-module (srfi srfi-26)
@@ -40,7 +41,8 @@
ntp-service
tor-service
bitlbee-service
- wicd-service))
+ wicd-service
+ network-manager-service))
;;; Commentary:
;;;
@@ -498,4 +500,43 @@ several commands to interact with the daemon and configure networking:
and @command{wicd-curses} user interfaces."
(service wicd-service-type wicd))
+
+;;;
+;;; NetworkManager
+;;;
+
+(define %network-manager-activation
+ ;; Activation gexp for NetworkManager.
+ #~(begin
+ (use-modules (guix build utils))
+ (mkdir-p "/etc/NetworkManager/system-connections")))
+
+(define (network-manager-dmd-service network-manager)
+ "Return a dmd service for NETWORK-MANAGER."
+ (list (dmd-service
+ (documentation "Run the NetworkManager.")
+ (provision '(networking))
+ (requirement '(user-processes dbus-system loopback))
+ (start #~(make-forkexec-constructor
+ (list (string-append #$network-manager
+ "/sbin/NetworkManager")
+ "--no-daemon")))
+ (stop #~(make-kill-destructor)))))
+
+(define network-manager-service-type
+ (service-type (name 'network-manager)
+ (extensions
+ (list (service-extension dmd-root-service-type
+ network-manager-dmd-service)
+ (service-extension dbus-root-service-type list)
+ (service-extension activation-service-type
+ (const %network-manager-activation))
+ ;; Add network-manager to the system profile.
+ (service-extension profile-service-type list)))))
+
+(define* (network-manager-service #:key (network-manager network-manager))
+ "Return a service that runs NetworkManager, a network connection manager
+that attempting to keep active network connectivity when available."
+ (service network-manager-service-type network-manager))
+
;;; networking.scm ends here