summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorFlorian Pelz <pelzflorian@pelzflorian.de>2019-06-19 18:09:01 +0200
committerLudovic Courtès <ludo@gnu.org>2019-06-24 23:25:11 +0200
commit57c16c97cb65742a58510760dd9f6cc41b6392ca (patch)
treeee450c3a0a44f9e2b4d2ce4b5b805a26dad1c0b5 /gnu
parent0207ebf0e95c416924929d33f1a5044fd3f45121 (diff)
downloadguix-57c16c97cb65742a58510760dd9f6cc41b6392ca.tar.gz
services: network-manager: Create '/var/lib/misc' directory for dnsmasq.
* gnu/services/networking.scm (%network-manager-activation): Rename to...
(network-manager-activation): ... this and make it a procedure.  Make it
create '/var/lib/misc' when using dnsmasq.
(network-manager-service-type): Use it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/networking.scm18
1 files changed, 12 insertions, 6 deletions
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 73acb3b17f..13cffd9feb 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -895,11 +895,17 @@ and @command{wicd-curses} user interfaces."
   (vpn-plugins network-manager-vpn-plugins        ;list of <package>
                (default '())))
 
-(define %network-manager-activation
-  ;; Activation gexp for NetworkManager.
-  #~(begin
-      (use-modules (guix build utils))
-      (mkdir-p "/etc/NetworkManager/system-connections")))
+(define network-manager-activation
+  ;; Activation gexp for NetworkManager
+  (match-lambda
+    (($ <network-manager-configuration> network-manager dns vpn-plugins)
+     #~(begin
+         (use-modules (guix build utils))
+         (mkdir-p "/etc/NetworkManager/system-connections")
+         #$@(if (equal? dns "dnsmasq")
+                ;; create directory to store dnsmasq lease file
+                '((mkdir-p "/var/lib/misc"))
+                '())))))
 
 (define (vpn-plugin-directory plugins)
   "Return a directory containing PLUGINS, the NM VPN plugins."
@@ -949,7 +955,7 @@ and @command{wicd-curses} user interfaces."
             (service-extension dbus-root-service-type config->package)
             (service-extension polkit-service-type config->package)
             (service-extension activation-service-type
-                               (const %network-manager-activation))
+                               network-manager-activation)
             (service-extension session-environment-service-type
                                network-manager-environment)
             ;; Add network-manager to the system profile.