zoekt: 3.7.2-2-unstable-2024-10-24 -> 3.7.2-2-unstable-2024-12-09 (#363818)
[NixPkgs.git] / pkgs / applications / gis / qgis / unwrapped-ltr.nix
blob6806ba5d41e4d485f2a0b50025a2861adbd047b6
2   lib,
3   fetchFromGitHub,
4   makeWrapper,
5   mkDerivation,
6   substituteAll,
7   wrapGAppsHook3,
8   wrapQtAppsHook,
10   withGrass,
11   withServer,
12   withWebKit,
14   bison,
15   cmake,
16   draco,
17   exiv2,
18   fcgi,
19   flex,
20   geos,
21   grass,
22   gsl,
23   hdf5,
24   libspatialindex,
25   libspatialite,
26   libzip,
27   netcdf,
28   ninja,
29   openssl,
30   pdal,
31   postgresql,
32   proj,
33   protobuf,
34   python3,
35   qca-qt5,
36   qscintilla,
37   qt3d,
38   qtbase,
39   qtkeychain,
40   qtlocation,
41   qtmultimedia,
42   qtsensors,
43   qtserialport,
44   qtwebkit,
45   qtxmlpatterns,
46   qwt,
47   sqlite,
48   txt2tags,
49   zstd,
52 let
53   py = python3.override {
54     self = py;
55     packageOverrides = self: super: {
56       pyqt5 = super.pyqt5.override {
57         withLocation = true;
58         withSerialPort = true;
59       };
60     };
61   };
63   pythonBuildInputs = with py.pkgs; [
64     chardet
65     gdal
66     jinja2
67     numpy
68     owslib
69     psycopg2
70     pygments
71     pyqt5
72     pyqt-builder
73     python-dateutil
74     pytz
75     pyyaml
76     qscintilla-qt5
77     requests
78     setuptools
79     sip
80     six
81     urllib3
82   ];
84 mkDerivation rec {
85   version = "3.34.13";
86   pname = "qgis-ltr-unwrapped";
88   src = fetchFromGitHub {
89     owner = "qgis";
90     repo = "QGIS";
91     rev = "final-${lib.replaceStrings [ "." ] [ "_" ] version}";
92     hash = "sha256-eNncDIRfFYFxyc5a2tZijmVpx/LNm/roak84guFvldg=";
93   };
95   passthru = {
96     inherit pythonBuildInputs;
97     inherit py;
98   };
100   nativeBuildInputs = [
101     makeWrapper
102     wrapGAppsHook3
103     wrapQtAppsHook
105     bison
106     cmake
107     flex
108     ninja
109   ];
111   buildInputs =
112     [
113       draco
114       exiv2
115       fcgi
116       geos
117       gsl
118       hdf5
119       libspatialindex
120       libspatialite
121       libzip
122       netcdf
123       openssl
124       pdal
125       postgresql
126       proj
127       protobuf
128       qca-qt5
129       qscintilla
130       qt3d
131       qtbase
132       qtkeychain
133       qtlocation
134       qtmultimedia
135       qtsensors
136       qtserialport
137       qtxmlpatterns
138       qwt
139       sqlite
140       txt2tags
141       zstd
142     ]
143     ++ lib.optional withGrass grass
144     ++ lib.optional withWebKit qtwebkit
145     ++ pythonBuildInputs;
147   patches = [
148     (substituteAll {
149       src = ./set-pyqt-package-dirs-ltr.patch;
150       pyQt5PackageDir = "${py.pkgs.pyqt5}/${py.pkgs.python.sitePackages}";
151       qsciPackageDir = "${py.pkgs.qscintilla-qt5}/${py.pkgs.python.sitePackages}";
152     })
153   ];
155   # Add path to Qt platform plugins
156   # (offscreen is needed by "${APIS_SRC_DIR}/generate_console_pap.py")
157   env.QT_QPA_PLATFORM_PLUGIN_PATH = "${qtbase}/${qtbase.qtPluginPrefix}/platforms";
159   cmakeFlags =
160     [
161       "-DWITH_3D=True"
162       "-DWITH_PDAL=True"
163       "-DENABLE_TESTS=False"
164     ]
165     ++ lib.optional (!withWebKit) "-DWITH_QTWEBKIT=OFF"
166     ++ lib.optional withServer [
167       "-DWITH_SERVER=True"
168       "-DQGIS_CGIBIN_SUBDIR=${placeholder "out"}/lib/cgi-bin"
169     ]
170     ++ lib.optional withGrass (
171       let
172         gmajor = lib.versions.major grass.version;
173         gminor = lib.versions.minor grass.version;
174       in
175       "-DGRASS_PREFIX${gmajor}=${grass}/grass${gmajor}${gminor}"
176     );
178   qtWrapperArgs = [
179     "--set QT_QPA_PLATFORM_PLUGIN_PATH ${qtbase}/${qtbase.qtPluginPrefix}/platforms"
180   ];
182   dontWrapGApps = true; # wrapper params passed below
184   postFixup = lib.optionalString withGrass ''
185     # GRASS has to be availble on the command line even though we baked in
186     # the path at build time using GRASS_PREFIX.
187     # Using wrapGAppsHook also prevents file dialogs from crashing the program
188     # on non-NixOS.
189     for program in $out/bin/*; do
190       wrapProgram $program \
191         "''${gappsWrapperArgs[@]}" \
192         --prefix PATH : ${lib.makeBinPath [ grass ]}
193     done
194   '';
196   meta = with lib; {
197     description = "Free and Open Source Geographic Information System";
198     homepage = "https://www.qgis.org";
199     license = licenses.gpl2Plus;
200     maintainers = with maintainers; teams.geospatial.members ++ [ lsix ];
201     platforms = with platforms; linux;
202   };