nix-config/pkgs/unbound-zones-adblock/default.nix
Bruno BELANYI 7ccb8ea8b5
All checks were successful
ci/woodpecker/push/check Pipeline was successful
pkgs: unbound-zones-adblock: use upstream package
This is a slight regression, as the current version of
`stevenblack-blocklist` is 3.13.10 and the version I packaged is
3.14.37.

However I am lazy and want to avoid having to bump the version
manually...
2023-12-16 14:28:46 +00:00

41 lines
1.2 KiB
Nix

{ lib, gawk, stdenvNoCC, stevenblack-blocklist }:
stdenvNoCC.mkDerivation {
name = "unbound-zones-adblock";
version = stevenblack-blocklist.rev;
src = stevenblack-blocklist;
dontUnpack = true;
installPhase =
let
gawkCmd = lib.concatStringsSep " " [
(lib.getExe gawk)
'''{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
''
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"
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;
maintainers = with maintainers; [ ambroisie ];
platforms = platforms.all;
};
}