unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/2] gnu: dnsmasq: Enable dbus support
@ 2017-01-19  6:55 Christopher Baines
  2017-01-19  6:55 ` [PATCH 2/2] services: network-manager: Use record for configuration Christopher Baines
  2017-01-19 12:06 ` [PATCH 1/2] gnu: dnsmasq: Enable dbus support 宋文武
  0 siblings, 2 replies; 7+ messages in thread
From: Christopher Baines @ 2017-01-19  6:55 UTC (permalink / raw)
  To: guix-devel

* gnu/pacakges/dns.scm (dnsmasq): Enable dbus support to allow for
NetworkManager to use dnsmasq.
[native-inputs]: Add pkg-config.
[inputs]: Add dbus.
[arguments]: Add COPTS="-DHAVE_DBUS" to make-flags.
---
 gnu/packages/dns.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm
index 2934e8e27..9d7739524 100644
--- a/gnu/packages/dns.scm
+++ b/gnu/packages/dns.scm
@@ -28,6 +28,7 @@
   #:use-module (gnu packages base)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages crypto)
+  #:use-module (gnu packages glib)
   #:use-module (gnu packages groff)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages linux)
@@ -53,11 +54,16 @@
                (base32
                 "15lzih6671gh9knzpl8mxchiml7z5lfqzr7jm2r0rjhrxs6nk4jb"))))
     (build-system gnu-build-system)
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("dbus" ,dbus)))
     (arguments
      `(#:phases
        (alist-delete 'configure %standard-phases)
        #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
-                          "CC=gcc")
+                          "CC=gcc"
+                          "COPTS=\"-DHAVE_DBUS\"")
        ;; No 'check' target.
        #:tests? #f))
     (home-page "http://www.thekelleys.org.uk/dnsmasq/doc.html")
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] services: network-manager: Use record for configuration.
  2017-01-19  6:55 [PATCH 1/2] gnu: dnsmasq: Enable dbus support Christopher Baines
@ 2017-01-19  6:55 ` Christopher Baines
  2017-01-19 11:44   ` 宋文武
  2017-01-19 12:06 ` [PATCH 1/2] gnu: dnsmasq: Enable dbus support 宋文武
  1 sibling, 1 reply; 7+ messages in thread
From: Christopher Baines @ 2017-01-19  6:55 UTC (permalink / raw)
  To: guix-devel

* gnu/services/network-manager.scm (<network-manager-configuration>): New
record type.
(network-manager-shpeherd-service): Change to use the
network-manager-configuration record, rather than a package.  Generate a
simple configuration file from the network-manager-configuration record.
(network-manager-service-type): Update extensions to take the
network-manager-configuration rather than a package.
---
 gnu/services/networking.scm | 77 +++++++++++++++++++++++++++++----------------
 1 file changed, 50 insertions(+), 27 deletions(-)

diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index ac011f128..8f136f0dc 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -64,7 +64,12 @@
 
             wicd-service-type
             wicd-service
-            network-manager-service
+
+            network-manager-configuration
+            network-manager-configuration?
+            network-manager-configuration-dns
+            network-manager-service-type
+
             connman-service
             wpa-supplicant-service-type))
 
@@ -679,40 +684,58 @@ and @command{wicd-curses} user interfaces."
 ;;; NetworkManager
 ;;;
 
+(define-record-type* <network-manager-configuration>
+  network-manager-configuration make-network-manager-configuration
+  network-manager-configuration?
+  (network-manager network-manager-configuration-network-manager
+                   (default network-manager))
+  (dns network-manager-configuration-dns
+       (default "default")))
+
 (define %network-manager-activation
   ;; Activation gexp for NetworkManager.
   #~(begin
       (use-modules (guix build utils))
       (mkdir-p "/etc/NetworkManager/system-connections")))
 
-(define (network-manager-shepherd-service network-manager)
-  "Return a shepherd service for NETWORK-MANAGER."
-  (list (shepherd-service
-         (documentation "Run the NetworkManager.")
-         (provision '(networking))
-         (requirement '(user-processes dbus-system wpa-supplicant loopback))
-         (start #~(make-forkexec-constructor
-                   (list (string-append #$network-manager
-                                        "/sbin/NetworkManager")
-                         "--no-daemon")))
-         (stop #~(make-kill-destructor)))))
+(define network-manager-shepherd-service
+  (match-lambda
+    (($ <network-manager-configuration> network-manager dns)
+     (let
+         ((conf (plain-file "NetworkManager.conf"
+                            (string-append "
+[main]
+dns=" dns "
+"))))
+     (list (shepherd-service
+            (documentation "Run the NetworkManager.")
+            (provision '(networking))
+            (requirement '(user-processes dbus-system wpa-supplicant loopback))
+            (start #~(make-forkexec-constructor
+                      (list (string-append #$network-manager
+                                           "/sbin/NetworkManager")
+                            (string-append "--config=" #$conf)
+                            "--no-daemon")))
+            (stop #~(make-kill-destructor))))))))
 
 (define network-manager-service-type
-  (service-type (name 'network-manager)
-                (extensions
-                 (list (service-extension shepherd-root-service-type
-                                          network-manager-shepherd-service)
-                       (service-extension dbus-root-service-type list)
-                       (service-extension polkit-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))
+  (let
+      ((config->package
+        (match-lambda
+         (($ <network-manager-configuration> network-manager)
+          (list network-manager)))))
+
+    (service-type
+     (name 'network-manager)
+     (extensions
+      (list (service-extension shepherd-root-service-type
+                               network-manager-shepherd-service)
+            (service-extension dbus-root-service-type config->package)
+            (service-extension polkit-service-type config->package)
+            (service-extension activation-service-type
+                               (const %network-manager-activation))
+            ;; Add network-manager to the system profile.
+            (service-extension profile-service-type config->package))))))
 
 \f
 ;;;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] services: network-manager: Use record for configuration.
  2017-01-19  6:55 ` [PATCH 2/2] services: network-manager: Use record for configuration Christopher Baines
@ 2017-01-19 11:44   ` 宋文武
  2017-01-20  8:01     ` [PATCH] " Christopher Baines
  2017-01-20  8:48     ` [PATCH 2/2] " Christopher Baines
  0 siblings, 2 replies; 7+ messages in thread
From: 宋文武 @ 2017-01-19 11:44 UTC (permalink / raw)
  To: Christopher Baines; +Cc: guix-devel

Christopher Baines <mail@cbaines.net> writes:

> * gnu/services/network-manager.scm (<network-manager-configuration>): New
> record type.
> (network-manager-shpeherd-service): Change to use the
> network-manager-configuration record, rather than a package.  Generate a
> simple configuration file from the network-manager-configuration record.
> (network-manager-service-type): Update extensions to take the
> network-manager-configuration rather than a package.
> ---
>  gnu/services/networking.scm | 77 +++++++++++++++++++++++++++++----------------
>  1 file changed, 50 insertions(+), 27 deletions(-)

Thanks, could you mention the remove of 'network-manager-service' in the
changelog and update the 'Network Manager' section of manual?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] gnu: dnsmasq: Enable dbus support
  2017-01-19  6:55 [PATCH 1/2] gnu: dnsmasq: Enable dbus support Christopher Baines
  2017-01-19  6:55 ` [PATCH 2/2] services: network-manager: Use record for configuration Christopher Baines
@ 2017-01-19 12:06 ` 宋文武
  1 sibling, 0 replies; 7+ messages in thread
From: 宋文武 @ 2017-01-19 12:06 UTC (permalink / raw)
  To: Christopher Baines; +Cc: guix-devel

Christopher Baines <mail@cbaines.net> writes:

> * gnu/pacakges/dns.scm (dnsmasq): Enable dbus support to allow for
> NetworkManager to use dnsmasq.
> [native-inputs]: Add pkg-config.
> [inputs]: Add dbus.
> [arguments]: Add COPTS="-DHAVE_DBUS" to make-flags.
> ---
>  gnu/packages/dns.scm | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>

Applied, thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] services: network-manager: Use record for configuration.
  2017-01-19 11:44   ` 宋文武
@ 2017-01-20  8:01     ` Christopher Baines
  2017-01-20  8:48     ` [PATCH 2/2] " Christopher Baines
  1 sibling, 0 replies; 7+ messages in thread
From: Christopher Baines @ 2017-01-20  8:01 UTC (permalink / raw)
  To: guix-devel

* gnu/services/network-manager.scm (<network-manager-configuration>): New
record type.
(network-manager-shpeherd-service): Change to use the
network-manager-configuration record, rather than a package.  Generate a
simple configuration file from the network-manager-configuration record.
(network-manager-service-type): Update extensions to take the
network-manager-configuration rather than a package.
(network-manager-service): Remove function, the network-manager-service-type
can be used instead, and this avoids keeping the function signature and value
coresponding to the service type in sync.
* doc/guix.texi (Networking Services): Remove documentation for the removed
network-manager-service procedure, and add documentation of the
network-manager-service-type variable and network-manager-configuration
record.
---
 doc/guix.texi               | 38 +++++++++++++++++++---
 gnu/services/networking.scm | 77 +++++++++++++++++++++++++++++----------------
 2 files changed, 83 insertions(+), 32 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 7cd9cd046..46daac3b9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8758,11 +8758,39 @@ and @command{wicd-curses} user interfaces.
 @end deffn
 
 @cindex NetworkManager
-@deffn {Scheme Procedure} network-manager-service @
-       [#:network-manager @var{network-manager}]
-Return a service that runs NetworkManager, a network connection manager
-attempting to keep network connectivity active when available.
-@end deffn
+
+@defvr {Scheme Variable} network-manager-service-type
+This is the service type for the
+@uref{https://wiki.gnome.org/Projects/NetworkManager, NetworkManager}
+service. The value for this service type is a
+@code{network-manager-configuration} record.
+@end defvr
+
+@deftp {Data Type} network-manager-configuration
+Data type representing the configuration of NetworkManager.
+
+@table @asis
+@item @code{network-manager} (default: @code{network-manager})
+The NetworkManager package to use.
+
+@item @code{dns} (default: @code{"default"})
+Processing mode for DNS, which affects how NetworkManager uses the
+@code{resolv.conf} configuration file.
+
+@table @samp
+@item default
+NetworkManager will update @code{resolv.conf} to reflect the nameservers
+provided by currently active connections.
+
+@item dnsmasq
+NetworkManager will run @code{dnsmasq} as a local caching nameserver,
+using a "split DNS" configuration if you are connected to a VPN, and
+then update @code{resolv.conf} to point to the local nameserver.
+
+@item none
+NetworkManager will not modify @code{resolv.conf}.
+@end table
+@end deftp
 
 @cindex Connman
 @deffn {Scheme Procedure} connman-service @
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index ac011f128..8f136f0dc 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -64,7 +64,12 @@
 
             wicd-service-type
             wicd-service
-            network-manager-service
+
+            network-manager-configuration
+            network-manager-configuration?
+            network-manager-configuration-dns
+            network-manager-service-type
+
             connman-service
             wpa-supplicant-service-type))
 
@@ -679,40 +684,58 @@ and @command{wicd-curses} user interfaces."
 ;;; NetworkManager
 ;;;
 
+(define-record-type* <network-manager-configuration>
+  network-manager-configuration make-network-manager-configuration
+  network-manager-configuration?
+  (network-manager network-manager-configuration-network-manager
+                   (default network-manager))
+  (dns network-manager-configuration-dns
+       (default "default")))
+
 (define %network-manager-activation
   ;; Activation gexp for NetworkManager.
   #~(begin
       (use-modules (guix build utils))
       (mkdir-p "/etc/NetworkManager/system-connections")))
 
-(define (network-manager-shepherd-service network-manager)
-  "Return a shepherd service for NETWORK-MANAGER."
-  (list (shepherd-service
-         (documentation "Run the NetworkManager.")
-         (provision '(networking))
-         (requirement '(user-processes dbus-system wpa-supplicant loopback))
-         (start #~(make-forkexec-constructor
-                   (list (string-append #$network-manager
-                                        "/sbin/NetworkManager")
-                         "--no-daemon")))
-         (stop #~(make-kill-destructor)))))
+(define network-manager-shepherd-service
+  (match-lambda
+    (($ <network-manager-configuration> network-manager dns)
+     (let
+         ((conf (plain-file "NetworkManager.conf"
+                            (string-append "
+[main]
+dns=" dns "
+"))))
+     (list (shepherd-service
+            (documentation "Run the NetworkManager.")
+            (provision '(networking))
+            (requirement '(user-processes dbus-system wpa-supplicant loopback))
+            (start #~(make-forkexec-constructor
+                      (list (string-append #$network-manager
+                                           "/sbin/NetworkManager")
+                            (string-append "--config=" #$conf)
+                            "--no-daemon")))
+            (stop #~(make-kill-destructor))))))))
 
 (define network-manager-service-type
-  (service-type (name 'network-manager)
-                (extensions
-                 (list (service-extension shepherd-root-service-type
-                                          network-manager-shepherd-service)
-                       (service-extension dbus-root-service-type list)
-                       (service-extension polkit-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))
+  (let
+      ((config->package
+        (match-lambda
+         (($ <network-manager-configuration> network-manager)
+          (list network-manager)))))
+
+    (service-type
+     (name 'network-manager)
+     (extensions
+      (list (service-extension shepherd-root-service-type
+                               network-manager-shepherd-service)
+            (service-extension dbus-root-service-type config->package)
+            (service-extension polkit-service-type config->package)
+            (service-extension activation-service-type
+                               (const %network-manager-activation))
+            ;; Add network-manager to the system profile.
+            (service-extension profile-service-type config->package))))))
 
 \f
 ;;;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] services: network-manager: Use record for configuration.
  2017-01-19 11:44   ` 宋文武
  2017-01-20  8:01     ` [PATCH] " Christopher Baines
@ 2017-01-20  8:48     ` Christopher Baines
  2017-01-20 13:48       ` 宋文武
  1 sibling, 1 reply; 7+ messages in thread
From: Christopher Baines @ 2017-01-20  8:48 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1026 bytes --]

宋文武 <iyzsong@member.fsf.org> writes:

> Christopher Baines <mail@cbaines.net> writes:
>
>> * gnu/services/network-manager.scm (<network-manager-configuration>): New
>> record type.
>> (network-manager-shpeherd-service): Change to use the
>> network-manager-configuration record, rather than a package.  Generate a
>> simple configuration file from the network-manager-configuration record.
>> (network-manager-service-type): Update extensions to take the
>> network-manager-configuration rather than a package.
>> ---
>>  gnu/services/networking.scm | 77 +++++++++++++++++++++++++++++----------------
>>  1 file changed, 50 insertions(+), 27 deletions(-)
>
> Thanks, could you mention the remove of 'network-manager-service' in the
> changelog and update the 'Network Manager' section of manual?

Thanks for your review. I've sent an updated patch now, which includes
the removal of network-manager-service in the commit message (I'm hoping
that is what you meant by changelog), and manual updates.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] services: network-manager: Use record for configuration.
  2017-01-20  8:48     ` [PATCH 2/2] " Christopher Baines
@ 2017-01-20 13:48       ` 宋文武
  0 siblings, 0 replies; 7+ messages in thread
From: 宋文武 @ 2017-01-20 13:48 UTC (permalink / raw)
  To: Christopher Baines; +Cc: guix-devel

Christopher Baines <mail@cbaines.net> writes:

> 宋文武 <iyzsong@member.fsf.org> writes:
>
>> Christopher Baines <mail@cbaines.net> writes:
>>
>>> * gnu/services/network-manager.scm (<network-manager-configuration>): New
>>> record type.
>>> (network-manager-shpeherd-service): Change to use the
>>> network-manager-configuration record, rather than a package.  Generate a
>>> simple configuration file from the network-manager-configuration record.
>>> (network-manager-service-type): Update extensions to take the
>>> network-manager-configuration rather than a package.
>>> ---
>>>  gnu/services/networking.scm | 77 +++++++++++++++++++++++++++++----------------
>>>  1 file changed, 50 insertions(+), 27 deletions(-)
>>
>> Thanks, could you mention the remove of 'network-manager-service' in the
>> changelog and update the 'Network Manager' section of manual?
>
> Thanks for your review. I've sent an updated patch now, which includes
> the removal of network-manager-service in the commit message (I'm hoping
> that is what you meant by changelog), and manual updates.

Applied, thank you!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-01-20 13:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-19  6:55 [PATCH 1/2] gnu: dnsmasq: Enable dbus support Christopher Baines
2017-01-19  6:55 ` [PATCH 2/2] services: network-manager: Use record for configuration Christopher Baines
2017-01-19 11:44   ` 宋文武
2017-01-20  8:01     ` [PATCH] " Christopher Baines
2017-01-20  8:48     ` [PATCH 2/2] " Christopher Baines
2017-01-20 13:48       ` 宋文武
2017-01-19 12:06 ` [PATCH 1/2] gnu: dnsmasq: Enable dbus support 宋文武

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).