diff options
author | makefu <github@syntax-fehler.de> | 2015-10-23 15:38:01 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2015-10-23 15:38:01 +0200 |
commit | a1d05482e5527d32baef9d9343b900dee8d46694 (patch) | |
tree | 2de3ac509481799f6188620987cdf1678ea675a5 /lass/3modules/dnsmasq.nix | |
parent | 709ebf6bbcc2e0d4644ed35cd42db47c4f2e78c5 (diff) | |
parent | 93dcfe5ad61903f90f422d9d6c97e499b240aa86 (diff) |
Merge remote-tracking branch 'cloudkrebs/master'
Diffstat (limited to 'lass/3modules/dnsmasq.nix')
-rw-r--r-- | lass/3modules/dnsmasq.nix | 55 |
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 |