From 1a77b59a8520b4d4ecbd06508de323e0f76c8ca2 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Tue, 31 Mar 2015 15:54:06 +0200 Subject: [PATCH] Add geolite-legacy 2015-03-26 The geoip package only installs a GeoIP _library_ which is useless without a GeoIP _database_. The only package to currently install such a database is ntopng, which manually downloads Maxmind's GeoLite Legacy files to a private location. Provide these as a separate package so other packages can use them as well. --- pkgs/data/misc/geolite-legacy/builder.sh | 19 ++++++++++ pkgs/data/misc/geolite-legacy/default.nix | 43 +++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 3 files changed, 64 insertions(+) create mode 100644 pkgs/data/misc/geolite-legacy/builder.sh create mode 100644 pkgs/data/misc/geolite-legacy/default.nix diff --git a/pkgs/data/misc/geolite-legacy/builder.sh b/pkgs/data/misc/geolite-legacy/builder.sh new file mode 100644 index 000000000000..1886d144e480 --- /dev/null +++ b/pkgs/data/misc/geolite-legacy/builder.sh @@ -0,0 +1,19 @@ +#!/bin/sh -e + +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 + +gunzip -v *.gz diff --git a/pkgs/data/misc/geolite-legacy/default.nix b/pkgs/data/misc/geolite-legacy/default.nix new file mode 100644 index 000000000000..c36e6f83106f --- /dev/null +++ b/pkgs/data/misc/geolite-legacy/default.nix @@ -0,0 +1,43 @@ +{ stdenv, fetchurl }: + +# Annoyingly, these files are updated without a change in URL. This means that +# builds will start failing every month or so, until the hashes are updated. +let version = "2015-03-26"; in +stdenv.mkDerivation { + name = "geolite-legacy-${version}"; + + srcGeoIP = fetchurl { + url = https://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz; + sha256 = "01xw896n9wcm1pv7sixfbh4gv6isl6m1i6lwag1c2bbcx6ci1zvr"; + }; + srcGeoIPv6 = fetchurl { + url = https://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz; + sha256 = "07l10hd7fkgk1nbw5gx4hjp61kdqqgri97fidn78dlk837rb02d0"; + }; + srcGeoLiteCity = fetchurl { + url = https://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz; + sha256 = "1xqjyz9xnga3dvhj0f38hf78wv781jflvqkxm6qni3sj781nfr4a"; + }; + srcGeoLiteCityv6 = fetchurl { + url = https://geolite.maxmind.com/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz; + sha256 = "03s41ffc5a13qy5kgx8jqya97jkw2qlvdkak98hab7xs0i17z9pd"; + }; + srcGeoIPASNum = fetchurl { + url = https://geolite.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz; + sha256 = "1h766l8dsfgzlrz0q76877xksaf5qf91nwnkqwb6zl1gkczbwy6p"; + }; + srcGeoIPASNumv6 = fetchurl { + url = https://download.maxmind.com/download/geoip/database/asnum/GeoIPASNumv6.dat.gz; + sha256 = "0dwi9b3amfpmpkknf9ipz2r8aq05gn1j2zlvanwwah3ib5cgva9d"; + }; + + meta = with stdenv.lib; { + description = "GeoLite Legacy IP geolocation databases"; + homepage = https://geolite.maxmind.com/download/geoip; + license = with licenses; cc-by-sa-30; + platforms = with platforms; linux; + maintainers = with maintainers; [ nckx ]; + }; + + builder = ./builder.sh; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4d8e714554b3..31c2bb7d91b7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9676,6 +9676,8 @@ let gentium = callPackage ../data/fonts/gentium {}; + geolite-legacy = callPackage ../data/misc/geolite-legacy { }; + gnome_user_docs = callPackage ../data/documentation/gnome-user-docs { }; inherit (gnome3) gsettings_desktop_schemas;