summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMichael Raskin <7c6f434c@mail.ru>2014-09-03 10:06:26 +0400
committerMichael Raskin <7c6f434c@mail.ru>2014-09-03 10:06:26 +0400
commita82c623c26e0d4addbfc6530b15ff7dd5c55b967 (patch)
treecdde0f2e862312c327a0875df214d334b674ea78 /nixos
parent74343ca3abe9968e1f59eda56627023a07270440 (diff)
parent9659d0f4fb5cc596e7574dc5dbaf0b4075fb1955 (diff)
downloadnixlib-a82c623c26e0d4addbfc6530b15ff7dd5c55b967.tar
nixlib-a82c623c26e0d4addbfc6530b15ff7dd5c55b967.tar.gz
nixlib-a82c623c26e0d4addbfc6530b15ff7dd5c55b967.tar.bz2
nixlib-a82c623c26e0d4addbfc6530b15ff7dd5c55b967.tar.lz
nixlib-a82c623c26e0d4addbfc6530b15ff7dd5c55b967.tar.xz
nixlib-a82c623c26e0d4addbfc6530b15ff7dd5c55b967.tar.zst
nixlib-a82c623c26e0d4addbfc6530b15ff7dd5c55b967.zip
Merge pull request #3940 from wkennington/master.dnsmasq
nixos/dnsmasq: Fix regressions during the systemd update
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/networking/dnsmasq.nix19
1 files changed, 12 insertions, 7 deletions
diff --git a/nixos/modules/services/networking/dnsmasq.nix b/nixos/modules/services/networking/dnsmasq.nix
index d2a8af6ac8b1..31d57a648bfa 100644
--- a/nixos/modules/services/networking/dnsmasq.nix
+++ b/nixos/modules/services/networking/dnsmasq.nix
@@ -11,7 +11,10 @@ let
       conf-file=/etc/dnsmasq-conf.conf
       resolv-file=/etc/dnsmasq-resolv.conf
     ''}
-      ${cfg.extraConfig}
+    ${flip concatMapStrings cfg.servers (server: ''
+      server=${server}
+    '')}
+    ${cfg.extraConfig}
   '';
 
 in
@@ -43,12 +46,10 @@ in
         default = [];
         example = [ "8.8.8.8" "8.8.4.4" ];
         description = ''
-          The parameter to dnsmasq -S.
+          The dns servers which dnsmasq should query.
         '';
       };
 
-
-
       extraConfig = mkOption {
         type = types.string;
         default = "";
@@ -67,8 +68,8 @@ in
 
   config = mkIf config.services.dnsmasq.enable {
 
-    environment.systemPackages = [ dnsmasq ]
-      ++ (if cfg.resolveLocalQueries then [ pkgs.openresolv ] else []);
+    networking.nameservers =
+      optional cfg.resolveLocalQueries "127.0.0.1";
 
     services.dbus.packages = [ dnsmasq ];
 
@@ -83,10 +84,14 @@ in
         description = "dnsmasq daemon";
         after = [ "network.target" ];
         wantedBy = [ "multi-user.target" ];
+        path = [ dnsmasq ];
+        preStart = ''
+          touch /etc/dnsmasq-{conf,resolv}.conf
+          dnsmasq --test
+        '';
         serviceConfig = {
           Type = "dbus";
           BusName = "uk.org.thekelleys.dnsmasq";
-          ExecStartPre = "${dnsmasq}/bin/dnsmasq --test";
           ExecStart = "${dnsmasq}/bin/dnsmasq -k --enable-dbus --user=dnsmasq -C ${dnsmasqConf}";
           ExecReload = "${dnsmasq}/bin/kill -HUP $MAINPID";
         };