Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 cmake, 6 pkg-config, 7 buildPackages, 8 callPackage, 9 sqlite, 10 libtiff, 11 curl, 12 gtest, 13 nlohmann_json, 14 python3, 15 cacert, 16}: 17 18stdenv.mkDerivation (finalAttrs: { 19 pname = "proj"; 20 version = "9.6.1"; 21 22 src = fetchFromGitHub { 23 owner = "OSGeo"; 24 repo = "PROJ"; 25 rev = finalAttrs.version; 26 hash = "sha256-81wrwBB11SKhq2dTBrvbuUd97iYkTYYrYyKpk2IlHAA="; 27 }; 28 29 patches = [ 30 # https://github.com/OSGeo/PROJ/pull/3252 31 ./only-add-curl-for-static-builds.patch 32 ]; 33 34 outputs = [ 35 "out" 36 "dev" 37 ]; 38 39 nativeBuildInputs = [ 40 cmake 41 pkg-config 42 ]; 43 44 buildInputs = [ 45 sqlite 46 libtiff 47 curl 48 nlohmann_json 49 ]; 50 51 nativeCheckInputs = [ 52 cacert 53 gtest 54 ]; 55 56 cmakeFlags = [ 57 "-DUSE_EXTERNAL_GTEST=ON" 58 "-DRUN_NETWORK_DEPENDENT_TESTS=OFF" 59 "-DNLOHMANN_JSON_ORIGIN=external" 60 "-DEXE_SQLITE3=${buildPackages.sqlite}/bin/sqlite3" 61 ]; 62 CXXFLAGS = [ 63 # GCC 13: error: 'int64_t' in namespace 'std' does not name a type 64 "-include cstdint" 65 ]; 66 67 preCheck = 68 let 69 libPathEnvVar = if stdenv.hostPlatform.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH"; 70 in 71 '' 72 export HOME=$TMPDIR 73 export TMP=$TMPDIR 74 export ${libPathEnvVar}=$PWD/lib 75 ''; 76 77 doCheck = true; 78 79 passthru.tests = { 80 python = python3.pkgs.pyproj; 81 proj = callPackage ./tests.nix { proj = finalAttrs.finalPackage; }; 82 }; 83 84 meta = with lib; { 85 changelog = "https://github.com/OSGeo/PROJ/blob/${finalAttrs.src.rev}/NEWS.md"; 86 description = "Cartographic Projections Library"; 87 homepage = "https://proj.org/"; 88 license = licenses.mit; 89 maintainers = with maintainers; [ dotlambda ]; 90 teams = [ teams.geospatial ]; 91 platforms = platforms.unix; 92 }; 93})