liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit c814a8782b5281eeca92303d6648ae92ed074108
parent e2efdd87d3916787e4574c06d30707522eea0f3f
Author: Daniel Barlow <dan@telent.net>
Date:   Sun, 29 Nov 2026 20:55:50 +0000

dnsmasq: add useHostsFile option

this and `hosts` config provide a convenient way for dnsmasq to know
local addresses for hosts that configure them statically instead of
making dhcp requests

Diffstat:
Mmodules/dnsmasq/default.nix | 7++++++-
Mmodules/dnsmasq/service.nix | 6+++++-
2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/dnsmasq/default.nix b/modules/dnsmasq/default.nix @@ -11,7 +11,7 @@ ... }: let - inherit (lib) mkOption types; + inherit (lib) mkOption mkBooleanOption types; inherit (pkgs) liminix; in { @@ -48,6 +48,11 @@ in ranges = mkOption { type = types.listOf types.str; }; + useHostsFile = mkOption { + type = types.bool; + description = "serve names from /etc/hosts"; + default = false; + }; hosts = mkOption { default = { }; type = types.attrsOf ( diff --git a/modules/dnsmasq/service.nix b/modules/dnsmasq/service.nix @@ -14,6 +14,7 @@ hosts, upstreams, resolvconf, + useHostsFile }: let name = "${interface.name}.dnsmasq"; @@ -60,7 +61,10 @@ longrun { "--no-resolv" } \ ${lib.concatStringsSep " " (mapAttrsToList hostOpt hosts)} \ - --no-hosts \ + ${if useHostsFile + then (builtins.trace "hosts" "" ) + else (builtins.trace "no hots" "--no-hosts") + } \ --log-dhcp \ --enable-ra \ --log-facility=- \