diff options
author | Nick Cao <nickcao@nichi.co> | 2023-02-26 09:29:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-26 09:29:56 +0800 |
commit | 8c36d213bbb626ebb0ba2c4bd6a0389e8a6638b0 (patch) | |
tree | 3d356dde01b3d6eb72e5d01ce14da17e780c703d /pkgs/data | |
parent | b828b4a039d30f36dac9d1c5779a0ed924c3bf79 (diff) | |
parent | 560c3389f4fe0b38294eb1da4853dd2128679a6b (diff) | |
download | nixpkgs-8c36d213bbb626ebb0ba2c4bd6a0389e8a6638b0.tar nixpkgs-8c36d213bbb626ebb0ba2c4bd6a0389e8a6638b0.tar.gz nixpkgs-8c36d213bbb626ebb0ba2c4bd6a0389e8a6638b0.tar.bz2 nixpkgs-8c36d213bbb626ebb0ba2c4bd6a0389e8a6638b0.tar.lz nixpkgs-8c36d213bbb626ebb0ba2c4bd6a0389e8a6638b0.tar.xz nixpkgs-8c36d213bbb626ebb0ba2c4bd6a0389e8a6638b0.tar.zst nixpkgs-8c36d213bbb626ebb0ba2c4bd6a0389e8a6638b0.zip |
Merge pull request #217181 from linsui/sing
sing-geoip: init at 20230112
Diffstat (limited to 'pkgs/data')
-rw-r--r-- | pkgs/data/misc/sing-geoip/default.nix | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/pkgs/data/misc/sing-geoip/default.nix b/pkgs/data/misc/sing-geoip/default.nix new file mode 100644 index 00000000000..e8ea5ddd442 --- /dev/null +++ b/pkgs/data/misc/sing-geoip/default.nix @@ -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; + }; +} |