Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 autoreconfHook, 6 drvName ? "geoip", 7 8 # in geoipDatabase, you can insert a package defining 9 # "${geoipDatabase}/share/GeoIP" e.g. geolite-legacy 10 geoipDatabase ? "/var/lib/geoip-databases", 11}: 12 13let 14 dataDir = 15 if lib.isDerivation geoipDatabase then "${toString geoipDatabase}/share/GeoIP" else geoipDatabase; 16 17in 18stdenv.mkDerivation rec { 19 pname = drvName; 20 version = "1.6.12"; 21 22 src = fetchFromGitHub { 23 owner = "maxmind"; 24 repo = "geoip-api-c"; 25 rev = "v${version}"; 26 sha256 = "0ixyp3h51alnncr17hqp1p0rlqz9w69nlhm60rbzjjz3vjx52ajv"; 27 }; 28 29 nativeBuildInputs = [ autoreconfHook ]; 30 31 # Cross compilation shenanigans 32 configureFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 33 "ac_cv_func_malloc_0_nonnull=yes" 34 "ac_cv_func_realloc_0_nonnull=yes" 35 ]; 36 37 # Fix up the default data directory 38 postConfigure = '' 39 find . -name Makefile.in -exec sed -i -r 's#^pkgdatadir\s*=.+$#pkgdatadir = ${dataDir}#' {} \; 40 ''; 41 42 passthru = { inherit dataDir; }; 43 44 meta = with lib; { 45 description = "API for GeoIP/Geolocation databases"; 46 maintainers = with maintainers; [ 47 thoughtpolice 48 raskin 49 ]; 50 license = licenses.lgpl21; 51 platforms = platforms.unix; 52 homepage = "https://www.maxmind.com"; 53 }; 54}