1{
2 lib,
3 config,
4 ...
5}: {
6 options.myNixOS.services.dnsmasq = {
7 enable = lib.mkEnableOption "dnsmasq";
8 longCaches = lib.mkOption {
9 type = lib.types.bool;
10 default = true;
11 description = "Have really long cache times.";
12 };
13 };
14
15 config = lib.mkIf config.myNixOS.services.dnsmasq.enable {
16 services.dnsmasq = {
17 enable = true;
18 settings = {
19 listen-address = "127.0.0.1";
20 cache-size = 1000;
21 no-resolv = true;
22
23 server = ["100.100.100.100"];
24
25 min-cache-ttl =
26 if config.myNixOS.services.dnsmasq.longCaches
27 then 3600
28 else 300;
29 max-cache-ttl =
30 if config.myNixOS.services.dnsmasq.longCaches
31 then 172800
32 else 3600;
33 };
34 };
35 services.tailscale.extraUpFlags = ["--accept-dns=false"];
36 networking.resolvconf.useLocalResolver = true;
37 };
38}