depot/third_party/nixpkgs/pkgs/applications/gis/qgis/unwrapped-ltr.nix
Default email 60f07311b9 Project import generated by Copybara.
GitOrigin-RevId: f8e2ebd66d097614d51a56a755450d4ae1632df1
2024-02-06 17:22:34 -08:00

181 lines
3.5 KiB
Nix

{ lib
, callPackage
, fetchFromGitHub
, fetchpatch
, makeWrapper
, mkDerivation
, substituteAll
, wrapGAppsHook
, withGrass ? true
, withWebKit ? false
, bison
, cmake
, 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
, qtsensors
, qtserialport
, qtwebkit
, qtxmlpatterns
, qwt
, sqlite
, txt2tags
, zstd
}:
let
py = python3.override {
packageOverrides = self: super: {
pyqt5 = super.pyqt5.override {
withLocation = true;
};
};
};
pythonBuildInputs = with py.pkgs; [
chardet
gdal
jinja2
numpy
owslib
psycopg2
pygments
pyqt-builder
pyqt5
python-dateutil
pytz
pyyaml
qscintilla-qt5
requests
setuptools
sip
six
urllib3
];
in mkDerivation rec {
version = "3.28.15";
pname = "qgis-ltr-unwrapped";
src = fetchFromGitHub {
owner = "qgis";
repo = "QGIS";
rev = "final-${lib.replaceStrings [ "." ] [ "_" ] version}";
hash = "sha256-R6p1MVeCMbaD74Eqn+OLQkTYP+00y9mBucJR1JXPEJ4=";
};
passthru = {
inherit pythonBuildInputs;
inherit py;
};
nativeBuildInputs = [
makeWrapper
wrapGAppsHook
bison
cmake
flex
ninja
];
buildInputs = [
openssl
proj
geos
sqlite
gsl
qwt
exiv2
protobuf
fcgi
libspatialindex
libspatialite
postgresql
txt2tags
libzip
hdf5
netcdf
qtbase
qtsensors
qca-qt5
qtkeychain
qscintilla
qtlocation
qtserialport
qtxmlpatterns
qt3d
# pdal
zstd
] ++ lib.optional withGrass grass
++ lib.optional withWebKit qtwebkit
++ pythonBuildInputs;
patches = [
(substituteAll {
src = ./set-pyqt-package-dirs-ltr.patch;
pyQt5PackageDir = "${py.pkgs.pyqt5}/${py.pkgs.python.sitePackages}";
qsciPackageDir = "${py.pkgs.qscintilla-qt5}/${py.pkgs.python.sitePackages}";
})
(fetchpatch {
name = "qgis-3.28.9-exiv2-0.28.patch";
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sci-geosciences/qgis/files/qgis-3.28.9-exiv2-0.28.patch?id=002882203ad6a2b08ce035a18b95844a9f4b85d0";
hash = "sha256-mPRo0A7ko4GCHJrfJ2Ls0dUKvkFtDmhKekI2CR9StMw=";
})
];
# PDAL is disabled until https://github.com/qgis/QGIS/pull/54940
# is backported.
cmakeFlags = [
"-DWITH_3D=True"
"-DWITH_PDAL=False" # TODO: re-enable PDAL
"-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}"
);
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;
};
}