1{
2 lib,
3 organicmaps,
4 fetchurl,
5 fetchFromGitea,
6 boost,
7 gtest,
8 glm,
9 gflags,
10 imgui,
11 jansson,
12 python3,
13 optipng,
14 utf8cpp,
15 nix-update-script,
16}:
17let
18 mapRev = 250822;
19
20 worldMap = fetchurl {
21 url = "https://cdn-fi-1.comaps.app/maps/${toString mapRev}/World.mwm";
22 hash = "sha256-OksUAix8yw0WQiJUwfMrjOCd/OwuRjdCOUjjGpnG2S8=";
23 };
24
25 worldCoasts = fetchurl {
26 url = "https://cdn-fi-1.comaps.app/maps/${toString mapRev}/WorldCoasts.mwm";
27 hash = "sha256-1OvKZJ3T/YJu6t/qTYliIVkwsT8toBSqGHUpDEk9i2k=";
28 };
29in
30organicmaps.overrideAttrs (oldAttrs: rec {
31 pname = "comaps";
32 version = "2025.08.31-15";
33
34 src = fetchFromGitea {
35 domain = "codeberg.org";
36 owner = "comaps";
37 repo = "comaps";
38 tag = "v${version}";
39 hash = "sha256-uRShcyMevNb/UE5+l8UabiGSr9TccVWp5xVoqI7+Oh8=";
40 fetchSubmodules = true;
41 };
42
43 patches = [
44 ./remove-lto.patch
45 ./use-vendored-protobuf.patch
46
47 # Include missing editor_tests_support.
48 ./fix-editor-tests.patch
49 ];
50
51 postPatch = (oldAttrs.postPatch or "") + ''
52 rm -f 3party/boost/b2
53 '';
54
55 nativeBuildInputs = (builtins.filter (x: x != python3) oldAttrs.nativeBuildInputs or [ ]) ++ [
56 (python3.withPackages (
57 ps: with ps; [
58 protobuf
59 ]
60 ))
61 optipng
62 ];
63
64 buildInputs = (oldAttrs.buildInputs or [ ]) ++ [
65 boost
66 gtest
67 gflags
68 glm
69 imgui
70 jansson
71 utf8cpp
72 ];
73
74 preConfigure = ''
75 bash ./configure.sh --skip-map-download
76 '';
77
78 cmakeFlags = [
79 (lib.cmakeBool "WITH_SYSTEM_PROVIDED_3PARTY" true)
80 ];
81
82 env = {
83 NIX_CFLAGS_COMPILE = toString [
84 "-I/build/source/3party/fast_double_parser/include"
85 ];
86 PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION = "python";
87 };
88
89 postInstall = ''
90 install -Dm644 ${worldMap} $out/share/comaps/data/World.mwm
91 install -Dm644 ${worldCoasts} $out/share/comaps/data/WorldCoasts.mwm
92 ln -s $out/bin/CoMaps $out/bin/comaps
93 '';
94
95 passthru.updateScript = nix-update-script {
96 extraArgs = [
97 "-vr"
98 "v(.*)"
99 ];
100 };
101
102 meta = oldAttrs.meta // {
103 description = "Community-led fork of Organic Maps";
104 homepage = "https://comaps.app";
105 changelog = "https://codeberg.org/comaps/comaps/releases/tag/v${version}";
106 maintainers = [ lib.maintainers.ryand56 ];
107 mainProgram = "comaps";
108 };
109})