Author: viric
Date: Wed Apr 13 14:09:02 2011
New Revision: 26820
URL: https://svn.nixos.org/websvn/nix/?rev=26820&sc=1

Log:
Adding a dnsmasq simple module.

Added:
   nixos/trunk/modules/services/networking/dnsmasq.nix
Modified:
   nixos/trunk/modules/module-list.nix

Modified: nixos/trunk/modules/module-list.nix
==============================================================================
--- nixos/trunk/modules/module-list.nix Wed Apr 13 10:03:07 2011        (r26819)
+++ nixos/trunk/modules/module-list.nix Wed Apr 13 14:09:02 2011        (r26820)
@@ -92,6 +92,7 @@
   ./services/networking/ddclient.nix
   ./services/networking/dhclient.nix
   ./services/networking/dhcpd.nix
+  ./services/networking/dnsmasq.nix
   ./services/networking/ejabberd.nix
   ./services/networking/firewall.nix
   ./services/networking/git-daemon.nix

Added: nixos/trunk/modules/services/networking/dnsmasq.nix
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ nixos/trunk/modules/services/networking/dnsmasq.nix Wed Apr 13 14:09:02 
2011        (r26820)
@@ -0,0 +1,57 @@
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+  cfg = config.services.dnsmasq;
+  dnsmasq = pkgs.dnsmasq;
+
+  serversParam = concatMapStrings (s: "-S ${s} ") cfg.servers;
+
+in
+
+{
+
+  ###### interface
+  
+  options = {
+  
+    services.dnsmasq = {
+
+      enable = mkOption {
+        default = true;
+        description = ''
+          Whether to run dnsmasq.
+        '';
+      };
+
+      servers = mkOption {
+        default = [];
+        example = [ "8.8.8.8" "8.8.4.4" ];
+        description = ''
+          The parameter to dnsmasq -S.
+        '';
+      };
+
+    };
+
+  };
+
+
+  ###### implementation
+
+  config = mkIf config.services.dnsmasq.enable {
+  
+    jobs.dnsmasq =
+      { description = "dnsmasq daemon";
+
+        startOn = "ip-up";
+
+        daemonType = "daemon";
+
+        exec = "${dnsmasq}/bin/dnsmasq -R ${serversParam}";
+      };
+    
+  };
+  
+}
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to