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