pkgs: add unbound-zones-adblock
Unbound wants a configuration file that is not actually formatted like StevenBlack's hosts files. This derivation fixes that.
This commit is contained in:
parent
20c20cef46
commit
d10f0ed103
|
@ -1,5 +1,5 @@
|
||||||
{ pkgs }:
|
{ pkgs }:
|
||||||
{
|
rec {
|
||||||
havm = pkgs.callPackage ./havm { };
|
havm = pkgs.callPackage ./havm { };
|
||||||
|
|
||||||
lohr = pkgs.callPackage ./lohr { };
|
lohr = pkgs.callPackage ./lohr { };
|
||||||
|
@ -8,5 +8,9 @@
|
||||||
|
|
||||||
podgrab = pkgs.callPackage ./podgrab { };
|
podgrab = pkgs.callPackage ./podgrab { };
|
||||||
|
|
||||||
|
unbound-zones-adblock = pkgs.callPackage ./unbound-zones-adblock {
|
||||||
|
inherit unified-hosts-lists;
|
||||||
|
};
|
||||||
|
|
||||||
unified-hosts-lists = pkgs.callPackage ./unified-hosts-lists { };
|
unified-hosts-lists = pkgs.callPackage ./unified-hosts-lists { };
|
||||||
}
|
}
|
||||||
|
|
37
pkgs/unbound-zones-adblock/default.nix
Normal file
37
pkgs/unbound-zones-adblock/default.nix
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{ fetchFromGitHub, gawk, lib, stdenvNoCC, unified-hosts-lists }:
|
||||||
|
stdenvNoCC.mkDerivation rec {
|
||||||
|
name = "unbound-zones-adblock";
|
||||||
|
version = unified-hosts-lists.version;
|
||||||
|
|
||||||
|
src = unified-hosts-lists;
|
||||||
|
|
||||||
|
phases = [ "installPhase" ];
|
||||||
|
|
||||||
|
installPhase =
|
||||||
|
let
|
||||||
|
gawkCmd = lib.concatStringsSep " " [
|
||||||
|
''${gawk}/bin/awk''
|
||||||
|
'''{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
|
||||||
|
''
|
||||||
|
mkdir -p $out
|
||||||
|
for file in $src/*; do
|
||||||
|
${gawkCmd} $file | tr '[:upper:]' '[:lower:]' | sort -u > $out/$(basename $file)
|
||||||
|
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;
|
||||||
|
platforms = platforms.all;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue