qgis, pyqt: introduce qgis-ltr and update qgis

Add qtlocation to pyqt, and ensure that it is included with both
qgis derivations.
This commit is contained in:
Matthew Pickering 2021-12-07 21:16:04 +00:00 committed by Jonathan Ringer
parent ce4927f0d5
commit 85d0a94f90
6 changed files with 217 additions and 16 deletions

View file

@ -1,5 +1,5 @@
{ lib, makeWrapper, symlinkJoin
, qgis-unwrapped, grass, extraPythonPackages ? (ps: [ ])
, qgis-unwrapped, extraPythonPackages ? (ps: [ ])
}:
with lib;
symlinkJoin rec {
@ -8,10 +8,10 @@ symlinkJoin rec {
paths = [ qgis-unwrapped ];
nativeBuildInputs = [ grass makeWrapper qgis-unwrapped.python3Packages.wrapPython ];
nativeBuildInputs = [ makeWrapper qgis-unwrapped.py.pkgs.wrapPython ];
# extend to add to the python environment of QGIS without rebuilding QGIS application.
pythonInputs = qgis-unwrapped.pythonBuildInputs ++ (extraPythonPackages qgis-unwrapped.python3Packages);
pythonInputs = qgis-unwrapped.pythonBuildInputs ++ (extraPythonPackages qgis-unwrapped.py.pkgs);
postBuild = ''
# unpackPhase
@ -20,7 +20,6 @@ symlinkJoin rec {
wrapProgram $out/bin/qgis \
--prefix PATH : $program_PATH \
--prefix PATH : ${lib.makeBinPath [grass]} \
--set PYTHONPATH $program_PYTHONPATH
'';

View file

@ -0,0 +1,26 @@
{ lib, makeWrapper, symlinkJoin
, qgis-ltr-unwrapped, extraPythonPackages ? (ps: [ ])
}:
with lib;
symlinkJoin rec {
inherit (qgis-ltr-unwrapped) version;
name = "qgis-${version}";
paths = [ qgis-ltr-unwrapped ];
nativeBuildInputs = [ makeWrapper qgis-ltr-unwrapped.py.pkgs.wrapPython ];
# extend to add to the python environment of QGIS without rebuilding QGIS application.
pythonInputs = qgis-ltr-unwrapped.pythonBuildInputs ++ (extraPythonPackages qgis-ltr-unwrapped.py.pkgs);
postBuild = ''
buildPythonPath "$pythonInputs"
wrapProgram $out/bin/qgis \
--prefix PATH : $program_PATH \
--set PYTHONPATH $program_PYTHONPATH
'';
inherit (qgis-ltr-unwrapped) meta;
}

View file

@ -0,0 +1,148 @@
{ lib
, mkDerivation
, fetchFromGitHub
, cmake
, ninja
, flex
, bison
, proj
, geos
, xlibsWrapper
, sqlite
, gsl
, qwt
, fcgi
, python3
, libspatialindex
, libspatialite
, postgresql
, txt2tags
, openssl
, libzip
, hdf5
, netcdf
, exiv2
, protobuf
, qtbase
, qtsensors
, qca-qt5
, qtkeychain
, qt3d
, qscintilla
, qtserialport
, qtxmlpatterns
, withGrass ? true
, grass
, withWebKit ? true
, qtwebkit
, makeWrapper
}:
let
py = python3.override {
packageOverrides = self: super: {
pyqt5 = super.pyqt5.override {
withLocation = true;
};
};
};
pythonBuildInputs = with py.pkgs; [
qscintilla-qt5
gdal
jinja2
numpy
psycopg2
chardet
python-dateutil
pyyaml
pytz
requests
urllib3
pygments
pyqt5
sip_4
owslib
six
];
in mkDerivation rec {
version = "3.16.14";
pname = "qgis-ltr-unwrapped";
src = fetchFromGitHub {
owner = "qgis";
repo = "QGIS";
rev = "final-${lib.replaceStrings [ "." ] [ "_" ] version}";
sha256 = "sha256-3FUGSBdlhJhhpTPtYuzKOznsC7PJV3kRL9Il2Yryi1Q=";
};
passthru = {
inherit pythonBuildInputs;
inherit py;
};
buildInputs = [
openssl
proj
geos
xlibsWrapper
sqlite
gsl
qwt
exiv2
protobuf
fcgi
libspatialindex
libspatialite
postgresql
txt2tags
libzip
hdf5
netcdf
qtbase
qtsensors
qca-qt5
qtkeychain
qscintilla
qtserialport
qtxmlpatterns
qt3d
] ++ lib.optional withGrass grass
++ lib.optional withWebKit qtwebkit
++ pythonBuildInputs;
nativeBuildInputs = [ makeWrapper cmake flex bison ninja ];
# Force this pyqt_sip_dir variable to point to the sip dir in PyQt5
#
# TODO: Correct PyQt5 to provide the expected directory and fix
# build to use PYQT5_SIP_DIR consistently.
postPatch = ''
substituteInPlace cmake/FindPyQt5.py \
--replace 'sip_dir = cfg.default_sip_dir' 'sip_dir = "${py.pkgs.pyqt5}/${py.pkgs.python.sitePackages}/PyQt5/bindings"'
'';
cmakeFlags = [
"-DCMAKE_SKIP_BUILD_RPATH=OFF"
"-DWITH_3D=True"
"-DPYQT5_SIP_DIR=${py.pkgs.pyqt5}/${py.pkgs.python.sitePackages}/PyQt5/bindings"
"-DQSCI_SIP_DIR=${py.pkgs.qscintilla-qt5}/${py.pkgs.python.sitePackages}/PyQt5/bindings"
] ++ lib.optional (!withWebKit) "-DWITH_QTWEBKIT=OFF"
++ lib.optional withGrass "-DGRASS_PREFIX7=${grass}/grass78";
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
wrapProgram $out/bin/qgis \
--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;
platforms = platforms.linux;
maintainers = with maintainers; [ lsix sikmir erictapen ];
};
}

View file

@ -12,7 +12,7 @@
, gsl
, qwt
, fcgi
, python3Packages
, python3
, libspatialindex
, libspatialite
, postgresql
@ -35,10 +35,22 @@
, grass
, withWebKit ? true
, qtwebkit
, pdal
, zstd
, makeWrapper
}:
let
pythonBuildInputs = with python3Packages; [
py = python3.override {
packageOverrides = self: super: {
pyqt5 = super.pyqt5.override {
withLocation = true;
};
};
};
pythonBuildInputs = with py.pkgs; [
qscintilla-qt5
gdal
jinja2
@ -57,19 +69,19 @@ let
six
];
in mkDerivation rec {
version = "3.16.14";
version = "3.22.1";
pname = "qgis-unwrapped";
src = fetchFromGitHub {
owner = "qgis";
repo = "QGIS";
rev = "final-${lib.replaceStrings [ "." ] [ "_" ] version}";
sha256 = "sha256-3FUGSBdlhJhhpTPtYuzKOznsC7PJV3kRL9Il2Yryi1Q=";
sha256 = "0hpbbv84lh1m7vrxv8d8x5kxgxcf0dydsvr3r2brgv3b40lpavd4";
};
passthru = {
inherit pythonBuildInputs;
inherit python3Packages;
inherit py;
};
buildInputs = [
@ -98,11 +110,13 @@ in mkDerivation rec {
qtserialport
qtxmlpatterns
qt3d
pdal
zstd
] ++ lib.optional withGrass grass
++ lib.optional withWebKit qtwebkit
++ pythonBuildInputs;
nativeBuildInputs = [ cmake flex bison ninja ];
nativeBuildInputs = [ makeWrapper cmake flex bison ninja ];
# Force this pyqt_sip_dir variable to point to the sip dir in PyQt5
#
@ -110,17 +124,25 @@ in mkDerivation rec {
# build to use PYQT5_SIP_DIR consistently.
postPatch = ''
substituteInPlace cmake/FindPyQt5.py \
--replace 'sip_dir = cfg.default_sip_dir' 'sip_dir = "${python3Packages.pyqt5}/${python3Packages.python.sitePackages}/PyQt5/bindings"'
--replace 'sip_dir = cfg.default_sip_dir' 'sip_dir = "${py.pkgs.pyqt5}/${py.pkgs.python.sitePackages}/PyQt5/bindings"'
'';
cmakeFlags = [
"-DCMAKE_SKIP_BUILD_RPATH=OFF"
"-DWITH_3D=True"
"-DPYQT5_SIP_DIR=${python3Packages.pyqt5}/${python3Packages.python.sitePackages}/PyQt5/bindings"
"-DQSCI_SIP_DIR=${python3Packages.qscintilla-qt5}/${python3Packages.python.sitePackages}/PyQt5/bindings"
"-DWITH_PDAL=TRUE"
"-DPYQT5_SIP_DIR=${py.pkgs.pyqt5}/${py.pkgs.python.sitePackages}/PyQt5/bindings"
"-DQSCI_SIP_DIR=${py.pkgs.qscintilla-qt5}/${py.pkgs.python.sitePackages}/PyQt5/bindings"
] ++ lib.optional (!withWebKit) "-DWITH_QTWEBKIT=OFF"
++ lib.optional withGrass "-DGRASS_PREFIX7=${grass}/grass78";
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
wrapProgram $out/bin/qgis \
--prefix PATH : ${lib.makeBinPath [ grass ]}
'';
meta = {
description = "A Free and Open Source Geographic Information System";
homepage = "https://www.qgis.org";

View file

@ -13,6 +13,7 @@
, withMultimedia ? false
, withWebKit ? false
, withWebSockets ? false
, withLocation ? false
}:
let
@ -59,6 +60,7 @@ in buildPythonPackage rec {
++ lib.optional withMultimedia qtmultimedia
++ lib.optional withWebKit qtwebkit
++ lib.optional withWebSockets qtwebsockets
++ lib.optional withLocation qtlocation
;
buildInputs = with libsForQt5; [
@ -71,6 +73,7 @@ in buildPythonPackage rec {
++ lib.optional withConnectivity qtconnectivity
++ lib.optional withWebKit qtwebkit
++ lib.optional withWebSockets qtwebsockets
++ lib.optional withLocation qtlocation
;
propagatedBuildInputs = [
@ -107,6 +110,7 @@ in buildPythonPackage rec {
++ lib.optional withWebKit "PyQt5.QtWebKit"
++ lib.optional withMultimedia "PyQt5.QtMultimedia"
++ lib.optional withConnectivity "PyQt5.QtConnectivity"
++ lib.optional withLocation "PyQt5.QtPositioning"
;
meta = with lib; {

View file

@ -28257,9 +28257,11 @@ with pkgs;
wrapQemuBinfmtP = callPackage ../applications/virtualization/qemu/binfmt-p-wrapper.nix { };
qgis-unwrapped = libsForQt5.callPackage ../applications/gis/qgis/unwrapped.nix {
withGrass = true;
};
qgis-ltr-unwrapped = libsForQt5.callPackage ../applications/gis/qgis/unwrapped-ltr.nix { };
qgis-ltr = callPackage ../applications/gis/qgis/ltr.nix { };
qgis-unwrapped = libsForQt5.callPackage ../applications/gis/qgis/unwrapped.nix { };
qgis = callPackage ../applications/gis/qgis { };