mirror of
https://github.com/StevenBlack/hosts.git
synced 2026-07-01 02:36:52 +00:00
Add unbound config nix package
This commit is contained in:
19
unbound.nix
Normal file
19
unbound.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
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
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user