geolite-legacy: 2017-12-02 -> 2022-01-25

Use database from mailfud.org, with Arch Linux package as a snapshot.
This commit is contained in:
Nikolay Amiantov 2022-02-12 15:11:32 +03:00
parent 6d5bbc7006
commit 3965d4c962
2 changed files with 23 additions and 50 deletions

View File

@ -1,20 +0,0 @@
source "$stdenv/setup"
mkdir -p $out/share/GeoIP
cd $out/share/GeoIP
# Iterate over all environment variable names beginning with "src":
for var in "${!src@}"; do
# Store the value of the variable with name $var in $src:
eval src="\$$var"
# Copy $src to current directory, removing Nix hash from the filename:
dest="${src##*/}"
dest="${dest#*-}"
cp "$src" "$dest"
done
gzip -dv *.gz
ln -s GeoLiteCity.dat GeoIPCity.dat
ln -s GeoLiteCityv6.dat GeoIPCityv6.dat

View File

@ -1,41 +1,34 @@
{ lib, stdenv, fetchurl }:
{ lib, stdenv, fetchurl, zstd }:
let
fetchDB = src: sha256: fetchurl {
inherit sha256;
url = "https://geolite.maxmind.com/download/geoip/database/${src}";
};
in
stdenv.mkDerivation {
pname = "geolite-legacy";
version = "2017-12-02";
version = "2022-01-25";
srcGeoIP = fetchDB
"GeoLiteCountry/GeoIP.dat.gz"
"1nggml11wzlanmzk6wbw2kla91fj8ggd9kh9yz42lnyckdlf5ac4";
srcGeoIPv6 = fetchDB
"GeoIPv6.dat.gz"
"0w809xgmr5zi4fgm9q3lhrnh1vl62s49n737bhq4jplm5918ki50";
srcGeoLiteCity = fetchDB
"GeoLiteCity.dat.gz"
"0cibajsv5xdjpw1qfx22izm5azqcj0d7nvk39irgwflkim9jfjbs";
srcGeoLiteCityv6 = fetchDB
"GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz"
"1ldwbzgs64irfgb3kq3jp8fmhwmwqk713dr4kkdqlglrblr9hfkc";
srcGeoIPASNum = fetchDB
"asnum/GeoIPASNum.dat.gz"
"06qqs8qr8vxqwd80npz7n66k3bpc1vs7w43i2bb4k0di5yxnjwr9";
srcGeoIPASNumv6 = fetchDB
"asnum/GeoIPASNumv6.dat.gz"
"1qyq4h8cja62giv6q1qqc502vsq53wzz1kx80mgvwngmycrxa21k";
# We use Arch Linux package as a snapshot, because upstream database is updated in-place.
geoip = fetchurl {
url = "https://archive.archlinux.org/packages/g/geoip-database/geoip-database-20220125-1-any.pkg.tar.zst";
sha256 = "sha256-ieuLpllJTHYu28UXBGfDWbnr9Ei8pGnos+RPWDsAGcM=";
};
extra = fetchurl {
url = "https://archive.archlinux.org/packages/g/geoip-database-extra/geoip-database-extra-20220125-1-any.pkg.tar.zst";
sha256 = "sha256-xrTnuJvuvtvn+uIARtbuJUlHco3Q+9BXLljt35V3ip0=";
};
nativeBuildInputs = [ zstd ];
buildCommand = ''
tar -xaf "$geoip"
tar -xaf "$extra"
mkdir -p $out/share
mv usr/share/GeoIP $out/share
'';
meta = with lib; {
description = "GeoLite Legacy IP geolocation databases";
homepage = "https://geolite.maxmind.com/download/geoip";
license = licenses.cc-by-sa-30;
homepage = "https://mailfud.org/geoip-legacy/";
license = licenses.cc-by-sa-40;
platforms = platforms.all;
maintainers = with maintainers; [ fpletz ];
};
builder = ./builder.sh;
}