2023-12-16 15:28:46 +01:00
|
|
|
{ lib, gawk, stdenvNoCC, stevenblack-blocklist }:
|
2023-05-03 18:54:53 +02:00
|
|
|
stdenvNoCC.mkDerivation {
|
2021-04-21 23:12:33 +02:00
|
|
|
name = "unbound-zones-adblock";
|
2024-07-25 20:28:04 +02:00
|
|
|
inherit (stevenblack-blocklist) version;
|
2021-04-21 23:12:33 +02:00
|
|
|
|
2023-12-16 15:28:46 +01:00
|
|
|
src = stevenblack-blocklist;
|
2021-04-21 23:12:33 +02:00
|
|
|
|
2021-08-31 20:11:00 +02:00
|
|
|
dontUnpack = true;
|
2021-04-21 23:12:33 +02:00
|
|
|
|
|
|
|
installPhase =
|
|
|
|
let
|
|
|
|
gawkCmd = lib.concatStringsSep " " [
|
2023-07-23 19:58:40 +02:00
|
|
|
(lib.getExe gawk)
|
2021-04-21 23:12:33 +02:00
|
|
|
'''{sub(/\r$/,"")}''
|
|
|
|
''{sub(/^127\.0\.0\.1/,"0.0.0.0")}''
|
|
|
|
''BEGIN { OFS = "" }''
|
|
|
|
''NF == 2 && $1 == "0.0.0.0" { print "local-zone: \"", $2, "\" static"}' ''
|
|
|
|
];
|
|
|
|
in
|
|
|
|
''
|
2023-12-16 15:28:46 +01:00
|
|
|
shopt -s globstar
|
|
|
|
for file in $src/**/hosts; do
|
|
|
|
outFile="$out/''${file#$src}"
|
|
|
|
mkdir -p "$(dirname "$outFile")"
|
|
|
|
${gawkCmd} $file | tr '[:upper:]' '[:lower:]' | sort -u > "$outFile"
|
2021-04-21 23:12:33 +02:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Unified host lists, ready to be used by unbound";
|
|
|
|
longDescription = ''
|
|
|
|
This is a simple derivation based on StevenBlack's unified hosts list.
|
|
|
|
The files have been modified for easy use wih unbound.
|
|
|
|
'';
|
|
|
|
homepage = "https://github.com/StevenBlack/hosts";
|
|
|
|
license = licenses.mit;
|
2021-05-13 10:27:19 +02:00
|
|
|
maintainers = with maintainers; [ ambroisie ];
|
2023-08-04 11:54:10 +02:00
|
|
|
platforms = platforms.all;
|
2021-04-21 23:12:33 +02:00
|
|
|
};
|
|
|
|
}
|