geoip: pass through the dataDir so consumers know where to look

+17 -10
+17 -10
pkgs/development/libraries/geoip/default.nix
··· 1 - { lib, stdenv, fetchFromGitHub, autoreconfHook 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , autoreconfHook 2 5 , drvName ? "geoip" 3 6 4 - # in geoipDatabase, you can insert a package defining 5 - # "${geoipDatabase}/share/GeoIP" e.g. geolite-legacy 7 + # in geoipDatabase, you can insert a package defining 8 + # "${geoipDatabase}/share/GeoIP" e.g. geolite-legacy 6 9 , geoipDatabase ? "/var/lib/geoip-databases" 7 10 }: 8 11 9 12 let 10 - dataDir = if lib.isDerivation geoipDatabase 13 + dataDir = 14 + if lib.isDerivation geoipDatabase 11 15 then "${toString geoipDatabase}/share/GeoIP" 12 16 else geoipDatabase; 17 + 13 18 in 14 19 stdenv.mkDerivation rec { 15 20 pname = drvName; 16 21 version = "1.6.12"; 17 22 18 23 src = fetchFromGitHub { 19 - owner = "maxmind"; 20 - repo = "geoip-api-c"; 21 - rev = "v${version}"; 24 + owner = "maxmind"; 25 + repo = "geoip-api-c"; 26 + rev = "v${version}"; 22 27 sha256 = "0ixyp3h51alnncr17hqp1p0rlqz9w69nlhm60rbzjjz3vjx52ajv"; 23 28 }; 24 29 ··· 35 40 find . -name Makefile.in -exec sed -i -r 's#^pkgdatadir\s*=.+$#pkgdatadir = ${dataDir}#' {} \; 36 41 ''; 37 42 43 + passthru = { inherit dataDir; }; 44 + 38 45 meta = with lib; { 39 46 description = "An API for GeoIP/Geolocation databases"; 40 47 maintainers = with maintainers; [ thoughtpolice raskin ]; 41 - license = licenses.lgpl21; 42 - platforms = platforms.unix; 43 - homepage = "https://www.maxmind.com"; 48 + license = licenses.lgpl21; 49 + platforms = platforms.unix; 50 + homepage = "https://www.maxmind.com"; 44 51 }; 45 52 }