This repository has no description
853 B
48 lines
1{ config, lib, pkgs, ... }:
2
3with builtins;
4with lib;
5
6let
7 cfg = config.lass.dnsmasq;
8
9 out = {
10 options.lass.dnsmasq = api;
11 config = mkIf cfg.enable imp;
12 };
13
14 api = {
15 enable = mkEnableOption "dnsmasq";
16 config = mkOption {
17 type = types.str;
18 #TODO: find a good default
19 default = ''
20 '';
21 description = "configuration dnsmasq is started with";
22 };
23 };
24
25 configFile = pkgs.writeText "dnsmasq.conf" cfg.config;
26
27 imp = {
28
29 systemd.services.dnsmasq = {
30 description = "dnsmasq";
31 after = [ "network.target" ];
32 wantedBy = [ "multi-user.target" ];
33
34 path = with pkgs; [
35 dnsmasq
36 ];
37
38
39 restartIfChanged = true;
40
41 serviceConfig = {
42 Restart = "always";
43 ExecStart = "${pkgs.dnsmasq}/bin/dnsmasq -k -C ${configFile}";
44 };
45 };
46 };
47
48in out