From 56fa177dd4ab30b4691cfee1422e1d27994b83fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Fri, 12 Jan 2024 01:15:11 +0200 Subject: [PATCH] more geoip attempts --- flake.lock | 39 +++++++++++++++++++++++++++++++++++++++ flake.nix | 32 +++++++++++++++++++++++++++++--- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 557beca..2d588a5 100644 --- a/flake.lock +++ b/flake.lock @@ -18,6 +18,42 @@ "type": "github" } }, + "geoip2-asn": { + "flake": false, + "locked": { + "narHash": "sha256-yGxCynYbOdA65wtcSO+Sjpo5eFOd1gdfRBuSWnbmPqs=", + "type": "file", + "url": "https://dl.jakstys.lt/_/GeoLite2-ASN.mmdb" + }, + "original": { + "type": "file", + "url": "https://dl.jakstys.lt/_/GeoLite2-ASN.mmdb" + } + }, + "geoip2-city": { + "flake": false, + "locked": { + "narHash": "sha256-M42YId3Kml/ks4z2HVJMsZ25GGQ6ISEBaz5du4tHGyc=", + "type": "file", + "url": "https://dl.jakstys.lt/_/GeoLite2-City.mmdb" + }, + "original": { + "type": "file", + "url": "https://dl.jakstys.lt/_/GeoLite2-City.mmdb" + } + }, + "geoip2-country": { + "flake": false, + "locked": { + "narHash": "sha256-5lecpKFEhhJuVtPSMpPz0nR8WHUF1XbJkN+h4K9VTSQ=", + "type": "file", + "url": "https://dl.jakstys.lt/_/GeoLite2-Country.mmdb" + }, + "original": { + "type": "file", + "url": "https://dl.jakstys.lt/_/GeoLite2-Country.mmdb" + } + }, "nixpkgs": { "locked": { "lastModified": 1704420045, @@ -37,6 +73,9 @@ "root": { "inputs": { "flake-utils": "flake-utils", + "geoip2-asn": "geoip2-asn", + "geoip2-city": "geoip2-city", + "geoip2-country": "geoip2-country", "nixpkgs": "nixpkgs" } }, diff --git a/flake.nix b/flake.nix index 192f4b2..c96ba60 100644 --- a/flake.nix +++ b/flake.nix @@ -7,11 +7,26 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; flake-utils.url = "github:numtide/flake-utils"; + geoip2-asn = { + url = "https://dl.jakstys.lt/_/GeoLite2-ASN.mmdb"; + flake = false; + }; + geoip2-city = { + url = "https://dl.jakstys.lt/_/GeoLite2-City.mmdb"; + flake = false; + }; + geoip2-country = { + url = "https://dl.jakstys.lt/_/GeoLite2-Country.mmdb"; + flake = false; + }; }; outputs = { self, nixpkgs, flake-utils, + geoip2-asn, + geoip2-city, + geoip2-country, ... }: flake-utils.lib.eachDefaultSystem (system: let @@ -22,15 +37,26 @@ python3Packages.django-compressor dart-sass - geoipWithDatabase python3Packages.geoip2 libmaxminddb ]; + geoip = pkgs.stdenv.mkDerivation { + name = geoip; + srcs = [geoip2-asn geoip2-city geoip2-country]; + dontUnpack = true; + installPhase = '' + runHook preInstall + mkdir -p $out + cp ${geoip2-asn} $out/ + cp ${geoip2-city} $out/ + cp ${geoip2-country} $out/ + ''; + }; in { devShells.default = pkgs.mkShell { LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive"; - GEOIP_PATH = "${pkgs.geolite-legacy}/share/GeoIP"; - packages = devDeps; + #GEOIP_PATH = "${geoip}"; + packages = devDeps ++ [geoip]; }; formatter = pkgs.alejandra;