Files
hosts/unbound.nix
2026-04-27 14:11:42 +02:00

14 lines
398 B
Nix

{
runCommandLocal,
}:
let
toUnboundConf = ''awk 'NF == 2 && $1 == "0.0.0.0" && $2 != "0.0.0.0" { printf "local-zone: \"%s\" always_nxdomain\n", $2 }'\'';
in
runCommandLocal "stevenblack-hosts-unbound" { src = ./.; } ''
mkdir $out
${toUnboundConf} < $src/hosts > $out/hosts
for file in $src/alternates/*/hosts; do
${toUnboundConf} < $file > $out/$(basename $(dirname $file))
done
''