sing-geoip: init at 20230112

This commit is contained in:
linsui 2023-02-25 14:20:56 +08:00
parent 19943b3161
commit 560c3389f4
2 changed files with 68 additions and 0 deletions

View file

@ -0,0 +1,66 @@
{ lib
, stdenvNoCC
, buildGoModule
, fetchFromGitHub
, clash-geoip
}:
let
generator = buildGoModule rec {
pname = "sing-geoip";
version = "unstable-2022-07-05";
src = fetchFromGitHub {
owner = "SagerNet";
repo = pname;
rev = "2ced72c94da4c9259c40353c375319d9d28a78f3";
hash = "sha256-z8aP+OfTuzQNwOT3EEnI9uze/vbHTJLEiCPqIrnNUHw=";
};
vendorHash = "sha256-lr0XMLFxJmLqIqCuGgmsFh324jmZVj71blmStMn41Rs=";
postPatch = ''
# The codes args should start from the third args
substituteInPlace main.go --replace "os.Args[2:]" "os.Args[3:]"
'';
meta = with lib; {
description = "GeoIP data for sing-box";
homepage = "https://github.com/SagerNet/sing-geoip";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ linsui ];
};
};
in
stdenvNoCC.mkDerivation rec {
inherit (generator) pname;
inherit (clash-geoip) version;
dontUnpack = true;
nativeBuildInputs = [ generator ];
buildPhase = ''
runHook preBuild
${pname} ${clash-geoip}/etc/clash/Country.mmdb geoip.db
${pname} ${clash-geoip}/etc/clash/Country.mmdb geoip-cn.db cn
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -Dm644 geoip.db $out/share/sing-box/geoip.db
install -Dm644 geoip-cn.db $out/share/sing-box/geoip-cn.db
runHook postInstall
'';
passthru = { inherit generator; };
meta = generator.meta // {
inherit (clash-geoip.meta) license;
};
}

View file

@ -12023,6 +12023,8 @@ with pkgs;
sing-geosite = callPackage ../data/misc/sing-geosite { }; sing-geosite = callPackage ../data/misc/sing-geosite { };
sing-geoip = callPackage ../data/misc/sing-geoip { };
sipcalc = callPackage ../tools/networking/sipcalc { }; sipcalc = callPackage ../tools/networking/sipcalc { };
skribilo = callPackage ../tools/typesetting/skribilo { skribilo = callPackage ../tools/typesetting/skribilo {