From 91f8d1a84cddeb15fbe36a928e06994577c1f7a0 Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Sun, 20 Oct 2024 16:02:15 +0800 Subject: [PATCH] dbip-city-lite: init at 2024-10 --- pkgs/by-name/db/dbip-city-lite/package.nix | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 pkgs/by-name/db/dbip-city-lite/package.nix diff --git a/pkgs/by-name/db/dbip-city-lite/package.nix b/pkgs/by-name/db/dbip-city-lite/package.nix new file mode 100644 index 000000000000..b0e3e4260cbe --- /dev/null +++ b/pkgs/by-name/db/dbip-city-lite/package.nix @@ -0,0 +1,35 @@ +{ + lib, + stdenvNoCC, + fetchurl, +}: +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "dbip-city-lite"; + version = "2024-10"; + + src = fetchurl { + url = "https://download.db-ip.com/free/dbip-city-lite-${finalAttrs.version}.mmdb.gz"; + hash = "sha256-sPjtO0WRdMxGiTySFO3vA1mL3RHxDnhLFzQ1fq2LNUw="; + }; + + dontUnpack = true; + + installPhase = '' + runHook preBuild + + gzip -c -d "$src" > dbip-city-lite.mmdb + install -Dm444 dbip-city-lite.mmdb "$out/share/dbip/dbip-city-lite.mmdb" + + runHook postBuild + ''; + + passthru.mmdb = "${finalAttrs.finalPackage}/share/dbip/dbip-city-lite.mmdb"; + + meta = { + description = "Free IP to City Lite database by DB-IP"; + homepage = "https://db-ip.com/db/download/ip-to-city-lite"; + license = lib.licenses.cc-by-40; + maintainers = with lib.maintainers; [ Guanran928 ]; + platforms = lib.platforms.all; + }; +})