stockholm/lass/3modules/dnsmasq.nix

49 lines
853 B
Nix
Raw Normal View History

2015-10-21 13:59:36 +00:00
{ config, lib, pkgs, ... }:
2016-02-15 15:27:11 +00:00
with builtins;
with lib;
2015-10-21 13:59:36 +00:00
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 = {
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