1

geoip: compress the archive

less inputs, less downloading.
This commit is contained in:
2024-01-15 10:52:46 +02:00
parent 85b75daba5
commit 290838e6e7
5 changed files with 35 additions and 75 deletions

View File

@@ -8,7 +8,7 @@
dart-sass,
gunicornPort ? 8001,
database-path ? null,
geoip-archive,
geoip-mmdb,
}:
stdenv.mkDerivation {
name = "e11sync";
@@ -32,12 +32,12 @@ stdenv.mkDerivation {
''} \
--set E11SYNC_DEBUG "" \
--set E11SYNC_COMPRESS_OFFLINE 1 \
--set GEOIP_PATH "${geoip-archive}" \
--set GEOIP_PATH "${geoip-mmdb}" \
--add-flags --bind=127.0.0.1:\$E11SYNC_HTTP_PORT \
--add-flags e11sync.wsgi
makeWrapper $out/app/manage.py $out/bin/e11sync \
--set GEOIP_PATH "${geoip-archive}"
--set GEOIP_PATH "${geoip-mmdb}"
'';
passthru.tests.unit =
runCommand "e11sync-test" {
@@ -51,7 +51,7 @@ stdenv.mkDerivation {
} ''
unpackPhase
patchShebangs --build app/manage.py
export GEOIP_PATH="${geoip-archive}"
export GEOIP_PATH="${geoip-mmdb}"
app/manage.py test app
mkdir -p $out
'';

View File

@@ -1,17 +0,0 @@
{
stdenv,
geoip2-asn,
geoip2-city,
geoip2-country,
}:
stdenv.mkDerivation {
name = "geoip-archive";
srcs = [geoip2-asn geoip2-city geoip2-country];
dontUnpack = true;
installPhase = ''
mkdir -p $out
cp ${geoip2-asn} $out/GeoLite2-ASN.mmdb
cp ${geoip2-city} $out/GeoLite2-City.mmdb
cp ${geoip2-country} $out/GeoLite2-Country.mmdb
'';
}

12
pkgs/geoip-mmdb.nix Normal file
View File

@@ -0,0 +1,12 @@
{
stdenv,
geoip2-tarball,
}:
stdenv.mkDerivation {
name = "geoip-mmdb";
srcs = [geoip2-tarball];
installPhase = ''
mkdir -p $out
cp GeoLite2-ASN.mmdb GeoLite2-City.mmdb GeoLite2-Country.mmdb $out/
'';
}