Merge pull request #217181 from linsui/sing

sing-geoip: init at 20230112
This commit is contained in:
Nick Cao 2023-02-26 09:29:56 +08:00 committed by GitHub
commit 8c36d213bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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

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