1

more geoip attempts

This commit is contained in:
Motiejus Jakštys 2024-01-12 01:15:11 +02:00
parent 1594a78ab1
commit 56fa177dd4
2 changed files with 68 additions and 3 deletions

View File

@ -18,6 +18,42 @@
"type": "github" "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1704420045, "lastModified": 1704420045,
@ -37,6 +73,9 @@
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"geoip2-asn": "geoip2-asn",
"geoip2-city": "geoip2-city",
"geoip2-country": "geoip2-country",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
}, },

View File

@ -7,11 +7,26 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
flake-utils.url = "github:numtide/flake-utils"; 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 = { outputs = {
self, self,
nixpkgs, nixpkgs,
flake-utils, flake-utils,
geoip2-asn,
geoip2-city,
geoip2-country,
... ...
}: }:
flake-utils.lib.eachDefaultSystem (system: let flake-utils.lib.eachDefaultSystem (system: let
@ -22,15 +37,26 @@
python3Packages.django-compressor python3Packages.django-compressor
dart-sass dart-sass
geoipWithDatabase
python3Packages.geoip2 python3Packages.geoip2
libmaxminddb 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 { in {
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive"; LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
GEOIP_PATH = "${pkgs.geolite-legacy}/share/GeoIP"; #GEOIP_PATH = "${geoip}";
packages = devDeps; packages = devDeps ++ [geoip];
}; };
formatter = pkgs.alejandra; formatter = pkgs.alejandra;