summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorFranz Pletz <fpletz@fnordicwalking.de>2017-10-25 04:07:27 +0200
committerGitHub <noreply@github.com>2017-10-25 04:07:27 +0200
commitfd9ae9226d1583f3d68fa585e0f18233b6f37ed9 (patch)
tree0e74332210e3a03c63842cb28bfb988c3538d9e4 /nixos/modules
parent28f0abae6d3c5c06fd58c62afdef1ae21997acc4 (diff)
parent0034f9e52c581e2f3dc924c3ff73630fae555024 (diff)
downloadnixlib-fd9ae9226d1583f3d68fa585e0f18233b6f37ed9.tar
nixlib-fd9ae9226d1583f3d68fa585e0f18233b6f37ed9.tar.gz
nixlib-fd9ae9226d1583f3d68fa585e0f18233b6f37ed9.tar.bz2
nixlib-fd9ae9226d1583f3d68fa585e0f18233b6f37ed9.tar.lz
nixlib-fd9ae9226d1583f3d68fa585e0f18233b6f37ed9.tar.xz
nixlib-fd9ae9226d1583f3d68fa585e0f18233b6f37ed9.tar.zst
nixlib-fd9ae9226d1583f3d68fa585e0f18233b6f37ed9.zip
Merge pull request #30319 from peterhoeg/f/dnsmasq
dnsmasq nixos: make sure it always runs
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/services/networking/dnsmasq.nix14
1 files changed, 12 insertions, 2 deletions
diff --git a/nixos/modules/services/networking/dnsmasq.nix b/nixos/modules/services/networking/dnsmasq.nix
index fcf5aa5f175b..91a3e54474ac 100644
--- a/nixos/modules/services/networking/dnsmasq.nix
+++ b/nixos/modules/services/networking/dnsmasq.nix
@@ -55,6 +55,14 @@ in
         '';
       };
 
+      alwaysKeepRunning = mkOption {
+        type = types.bool;
+        default = false;
+        description = ''
+          If enabled, systemd will always respawn dnsmasq even if shut down manually. The default, disabled, will only restart it on error.
+        '';
+      };
+
       extraConfig = mkOption {
         type = types.lines;
         default = "";
@@ -101,10 +109,12 @@ in
           BusName = "uk.org.thekelleys.dnsmasq";
           ExecStart = "${dnsmasq}/bin/dnsmasq -k --enable-dbus --user=dnsmasq -C ${dnsmasqConf}";
           ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
+          PrivateTmp = true;
+          ProtectSystem = true;
+          ProtectHome = true;
+          Restart = if cfg.alwaysKeepRunning then "always" else "on-failure";
         };
         restartTriggers = [ config.environment.etc.hosts.source ];
     };
-
   };
-
 }