1
Fork 0

geoip-archive: move to it's own package

This commit is contained in:
Motiejus Jakštys 2024-01-14 20:04:41 +02:00
parent dc72e8a2a4
commit 27e0979c86
2 changed files with 25 additions and 15 deletions

View File

@ -31,24 +31,18 @@
}: }:
flake-utils.lib.eachDefaultSystem (system: let flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;}; pkgs = import nixpkgs {inherit system;};
geoip-archive = pkgs.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
'';
};
in rec { in rec {
packages.geoip-archive = pkgs.callPackage ./pkgs/geoip-archive.nix {
inherit geoip2-asn geoip2-city geoip2-country;
};
packages.e11sync-static = pkgs.callPackage ./pkgs/e11sync-static.nix { packages.e11sync-static = pkgs.callPackage ./pkgs/e11sync-static.nix {
inherit self; inherit self;
}; };
packages.e11sync = pkgs.callPackage ./pkgs/e11sync.nix { packages.e11sync = pkgs.callPackage ./pkgs/e11sync.nix {
inherit self geoip-archive; inherit self;
geoip-archive = packages.geoip-archive;
}; };
checks.e11sync = packages.e11sync.passthru.tests.simple; checks.e11sync = packages.e11sync.passthru.tests.simple;
@ -65,7 +59,6 @@
}; };
devShells.default = pkgs.mkShellNoCC { devShells.default = pkgs.mkShellNoCC {
packages = with pkgs; [ packages = with pkgs; [
python3Packages.django-debug-toolbar python3Packages.django-debug-toolbar
python3Packages.django_5 python3Packages.django_5
@ -74,7 +67,7 @@
libmaxminddb libmaxminddb
dart-sass dart-sass
]; ];
GEOIP_PATH = "${geoip-archive}"; GEOIP_PATH = "${packages.geoip-archive}";
E11SYNC_DEBUG = "1"; E11SYNC_DEBUG = "1";
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive"; LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
}; };

17
pkgs/geoip-archive.nix Normal file
View File

@ -0,0 +1,17 @@
{
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
'';
}