diff options
author | lassulus <lass@aidsballs.de> | 2015-10-21 15:59:36 +0200 |
---|---|---|
committer | lassulus <lass@aidsballs.de> | 2015-10-21 15:59:36 +0200 |
commit | 10be0e70063ba83fef47295ebcbb1ac11a22c6b5 (patch) | |
tree | abcebb7c55f1c00dbc771e1e0e3b6c2e4e6e9c88 /lass/3modules | |
parent | 864f39634b7435e364f3a4b89336c6376ef9f696 (diff) |
l 3: add dnsmasq.nix
Diffstat (limited to 'lass/3modules')
-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 |