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

20 lines
475 B
Nix

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