1{
2 lib,
3 stdenv,
4 cmake,
5 fetchFromGitHub,
6 withFilters ? false,
7}:
8
9let
10 generic =
11 { version, hash }:
12 stdenv.mkDerivation {
13 inherit version;
14 pname = "h3";
15
16 src = fetchFromGitHub {
17 owner = "uber";
18 repo = "h3";
19 tag = "v${version}";
20 inherit hash;
21 };
22
23 outputs = [
24 "out"
25 "dev"
26 ];
27
28 nativeBuildInputs = [ cmake ];
29
30 cmakeFlags = [
31 (lib.cmakeBool "BUILD_SHARED_LIBS" true)
32 (lib.cmakeBool "BUILD_BENCHMARKS" false)
33 (lib.cmakeBool "BUILD_FUZZERS" false)
34 (lib.cmakeBool "BUILD_GENERATORS" false)
35 (lib.cmakeBool "ENABLE_COVERAGE" false)
36 (lib.cmakeBool "ENABLE_FORMAT" false)
37 (lib.cmakeBool "ENABLE_LINTING" false)
38 (lib.cmakeBool "BUILD_FILTERS" withFilters)
39 ];
40
41 meta = {
42 homepage = "https://h3geo.org/";
43 description = "Hexagonal hierarchical geospatial indexing system";
44 license = lib.licenses.asl20;
45 changelog = "https://github.com/uber/h3/raw/v${version}/CHANGELOG.md";
46 platforms = lib.platforms.all;
47 maintainers = with lib.maintainers; [ kalbasit ];
48 };
49 };
50in
51{
52 h3_3 = generic {
53 version = "3.7.2";
54 hash = "sha256-MvWqQraTnab6EuDx4V0v8EvrFWHT95f2EHTL2p2kei8=";
55 };
56
57 h3_4 = generic {
58 version = "4.2.0";
59 hash = "sha256-SzuxoYjsXCLhlAhQS7JoKvH8C3vquXttf58d4LnkeVM=";
60 };
61}