summaryrefslogtreecommitdiffstats
path: root/lass/3modules/dnsmasq.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2015-10-27 18:12:29 +0100
committermakefu <github@syntax-fehler.de>2015-10-27 18:12:29 +0100
commita85114c59c5102b839584f72454bca2c8abbb887 (patch)
tree18fc24394171f4afae3dee0e68e3781df75723ea /lass/3modules/dnsmasq.nix
parentfe4f5b98b91f6bacb036d57b5322fb4e09c22f14 (diff)
parent20ad77468131b7c69c5b3a26ea149ae7fdc0173b (diff)
Merge branch 'master' of pnp:stockholm
Diffstat (limited to 'lass/3modules/dnsmasq.nix')
-rw-r--r--lass/3modules/dnsmasq.nix55
1 files changed, 55 insertions, 0 deletions
diff --git a/lass/3modules/dnsmasq.nix b/lass/3modules/dnsmasq.nix
new file mode 100644
index 000000000..99c165479
--- /dev/null
+++ b/lass/3modules/dnsmasq.nix
@@ -0,0 +1,55 @@
+{ config, lib, pkgs, ... }:
+
+with builtins;
+with lib;
+
+let
+ cfg = config.lass.dnsmasq;
+
+ out = {
+ options.lass.dnsmasq = api;
+ config = mkIf cfg.enable imp;
+ };
+
+ api = {
+ enable = mkEnableOption "dnsmasq";
+ config = mkOption {
+ type = types.str;
+ #TODO: find a good default
+ default = ''
+ '';
+ description = "configuration dnsmasq is started with";
+ };
+ };
+
+ configFile = pkgs.writeText "dnsmasq.conf" cfg.config;
+
+ imp = {
+ #users.extraUsers.go = {
+ # name = "go";
+ # uid = 42774411; #genid go
+ # description = "go url shortener user";
+ # home = "/var/lib/go";
+ # createHome = true;
+ #};
+
+ systemd.services.dnsmasq = {
+ description = "dnsmasq";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+
+ path = with pkgs; [
+ dnsmasq
+ ];
+
+
+ restartIfChanged = true;
+
+ serviceConfig = {
+ Restart = "always";
+ ExecStart = "${pkgs.dnsmasq}/bin/dnsmasq -k -C ${configFile}";
+ };
+ };
+ };
+
+in out