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.
This commit is contained in:
宋文武 2015-11-16 13:56:24 +08:00
parent bde2171d4d
commit 7234ad4f54
1 changed files with 42 additions and 1 deletions

View File

@ -29,6 +29,7 @@
#:use-module (gnu packages messaging) #:use-module (gnu packages messaging)
#:use-module (gnu packages ntp) #:use-module (gnu packages ntp)
#:use-module (gnu packages wicd) #:use-module (gnu packages wicd)
#:use-module (gnu packages gnome)
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module (guix records) #:use-module (guix records)
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
@ -40,7 +41,8 @@
ntp-service ntp-service
tor-service tor-service
bitlbee-service bitlbee-service
wicd-service)) wicd-service
network-manager-service))
;;; Commentary: ;;; Commentary:
;;; ;;;
@ -498,4 +500,43 @@ several commands to interact with the daemon and configure networking:
and @command{wicd-curses} user interfaces." and @command{wicd-curses} user interfaces."
(service wicd-service-type wicd)) (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 ;;; networking.scm ends here