diff --git a/pkgs/applications/gis/grass/default.nix b/pkgs/applications/gis/grass/default.nix index 09c1fddbda21e..16e6a818e5aef 100644 --- a/pkgs/applications/gis/grass/default.nix +++ b/pkgs/applications/gis/grass/default.nix @@ -1,24 +1,25 @@ { lib, stdenv, fetchFromGitHub, flex, bison, pkg-config, zlib, libtiff, libpng, fftw -, cairo, readline, ffmpeg_3, makeWrapper, wxGTK30, netcdf, blas -, proj, gdal, geos, sqlite, postgresql, libmysqlclient, python2Packages, libLAS, proj-datumgrid +, cairo, readline, ffmpeg, makeWrapper, wxGTK30, netcdf, blas +, proj, gdal, geos, sqlite, postgresql, libmysqlclient, python3Packages, libLAS, proj-datumgrid +, zstd, pdal, wrapGAppsHook }: stdenv.mkDerivation rec { name = "grass"; - version = "7.6.1"; + version = "7.8.6"; src = with lib; fetchFromGitHub { owner = "OSGeo"; repo = "grass"; - rev = "${name}_${replaceStrings ["."] ["_"] version}"; - sha256 = "1amjk9rz7vw5ha7nyl5j2bfwj5if9w62nlwx5qbp1x7spldimlll"; + rev = version; + sha256 = "sha256-zvZqFWuxNyA+hu+NMiRbQVdzzrQPsZrdGdfVB17+SbM="; }; nativeBuildInputs = [ pkg-config ]; - buildInputs = [ flex bison zlib proj gdal libtiff libpng fftw sqlite cairo proj - readline ffmpeg_3 makeWrapper wxGTK30 netcdf geos postgresql libmysqlclient blas - libLAS proj-datumgrid ] - ++ (with python2Packages; [ python python-dateutil wxPython30 numpy ]); + buildInputs = [ flex bison zlib proj gdal libtiff libpng fftw sqlite cairo + readline ffmpeg makeWrapper wxGTK30 netcdf geos postgresql libmysqlclient blas + libLAS proj-datumgrid zstd pdal wrapGAppsHook ] + ++ (with python3Packages; [ python python-dateutil wxPython_4_1 numpy ]); # On Darwin the installer tries to symlink the help files into a system # directory @@ -37,6 +38,7 @@ stdenv.mkDerivation rec { "--with-readline" "--with-wxwidgets" "--with-netcdf" + "--with-pdal" "--with-geos" "--with-postgres" "--with-postgres-libs=${postgresql.lib}/lib/" @@ -46,6 +48,9 @@ stdenv.mkDerivation rec { "--with-mysql-libs=${libmysqlclient}/lib/mysql" "--with-blas" "--with-liblas=${libLAS}/bin/liblas-config" + "--with-zstd" + "--with-fftw" + "--with-pthread" ]; # Otherwise a very confusing "Can't load GDAL library" error @@ -62,6 +67,7 @@ stdenv.mkDerivation rec { scripts/g.extension.all/g.extension.all.py \ scripts/r.drain/r.drain.py \ scripts/r.pack/r.pack.py \ + scripts/r.import/r.import.py \ scripts/r.tileset/r.tileset.py \ scripts/r.unpack/r.unpack.py \ scripts/v.clip/v.clip.py \ @@ -79,18 +85,17 @@ stdenv.mkDerivation rec { temporal/t.rast.algebra/t.rast.algebra.py \ temporal/t.rast3d.algebra/t.rast3d.algebra.py \ temporal/t.vect.algebra/t.vect.algebra.py \ + temporal/t.downgrade/t.downgrade.py \ temporal/t.select/t.select.py for d in gui lib scripts temporal tools; do patchShebangs $d done ''; - NIX_CFLAGS_COMPILE = "-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1"; - postInstall = '' - wrapProgram $out/bin/grass76 \ + wrapProgram $out/bin/grass78 \ --set PYTHONPATH $PYTHONPATH \ - --set GRASS_PYTHON ${python2Packages.python}/bin/${python2Packages.python.executable} \ + --set GRASS_PYTHON ${python3Packages.python.interpreter} \ --suffix LD_LIBRARY_PATH ':' '${gdal}/lib' ln -s $out/grass*/lib $out/lib ln -s $out/grass*/include $out/include diff --git a/pkgs/applications/gis/qgis/default.nix b/pkgs/applications/gis/qgis/default.nix index f272fd04dd0df..b3220f8d7081d 100644 --- a/pkgs/applications/gis/qgis/default.nix +++ b/pkgs/applications/gis/qgis/default.nix @@ -1,17 +1,21 @@ { lib, makeWrapper, symlinkJoin -, qgis-unwrapped, extraPythonPackages ? (ps: [ ]) +, extraPythonPackages ? (ps: [ ]) +, libsForQt5 }: with lib; -symlinkJoin rec { +let + qgis-unwrapped = libsForQt5.callPackage ./unwrapped.nix { }; +in symlinkJoin rec { + inherit (qgis-unwrapped) version; name = "qgis-${version}"; paths = [ qgis-unwrapped ]; - nativeBuildInputs = [ 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 @@ -23,5 +27,7 @@ symlinkJoin rec { --set PYTHONPATH $program_PYTHONPATH ''; + passthru.unwrapped = qgis-unwrapped; + meta = qgis-unwrapped.meta; } diff --git a/pkgs/applications/gis/qgis/ltr.nix b/pkgs/applications/gis/qgis/ltr.nix new file mode 100644 index 0000000000000..5db9a26ae7587 --- /dev/null +++ b/pkgs/applications/gis/qgis/ltr.nix @@ -0,0 +1,32 @@ +{ lib, makeWrapper, symlinkJoin +, extraPythonPackages ? (ps: [ ]) +, libsForQt5 +}: +with lib; +let + qgis-ltr-unwrapped = libsForQt5.callPackage ./unwrapped-ltr.nix { }; +in 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 + ''; + + passthru.unwrapped = qgis-ltr-unwrapped; + + inherit (qgis-ltr-unwrapped) meta; +} diff --git a/pkgs/applications/gis/qgis/unwrapped-ltr.nix b/pkgs/applications/gis/qgis/unwrapped-ltr.nix new file mode 100644 index 0000000000000..3de304f586fd0 --- /dev/null +++ b/pkgs/applications/gis/qgis/unwrapped-ltr.nix @@ -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.16"; + pname = "qgis-ltr-unwrapped"; + + src = fetchFromGitHub { + owner = "qgis"; + repo = "QGIS"; + rev = "final-${lib.replaceStrings [ "." ] [ "_" ] version}"; + sha256 = "85RlV1Ik1BeN9B7UE51ktTWMiGkMga2E/fnhyiVwjIs="; + }; + + 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 ]; + }; +} diff --git a/pkgs/applications/gis/qgis/unwrapped.nix b/pkgs/applications/gis/qgis/unwrapped.nix index 14bafb6c51bc5..816368bbabc6f 100644 --- a/pkgs/applications/gis/qgis/unwrapped.nix +++ b/pkgs/applications/gis/qgis/unwrapped.nix @@ -12,7 +12,7 @@ , gsl , qwt , fcgi -, python3Packages +, python3 , libspatialindex , libspatialite , postgresql @@ -27,6 +27,7 @@ , qtsensors , qca-qt5 , qtkeychain +, qt3d , qscintilla , qtserialport , qtxmlpatterns @@ -34,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 @@ -56,19 +69,19 @@ let six ]; in mkDerivation rec { - version = "3.16.14"; + version = "3.22.3"; pname = "qgis-unwrapped"; src = fetchFromGitHub { owner = "qgis"; repo = "QGIS"; rev = "final-${lib.replaceStrings [ "." ] [ "_" ] version}"; - sha256 = "sha256-3FUGSBdlhJhhpTPtYuzKOznsC7PJV3kRL9Il2Yryi1Q="; + sha256 = "TLXhXHU0dp0MnKHFw/+1rQnJbebnwje21Oasy0qWctk="; }; passthru = { inherit pythonBuildInputs; - inherit python3Packages; + inherit py; }; buildInputs = [ @@ -96,11 +109,14 @@ in mkDerivation rec { qscintilla 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 # @@ -108,15 +124,24 @@ 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" - "-DPYQT5_SIP_DIR=${python3Packages.pyqt5}/${python3Packages.python.sitePackages}/PyQt5/bindings" - "-DQSCI_SIP_DIR=${python3Packages.qscintilla-qt5}/${python3Packages.python.sitePackages}/PyQt5/bindings" + "-DWITH_3D=True" + "-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}/${grass.name}"; + ++ 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"; diff --git a/pkgs/development/python-modules/pyqt/5.x.nix b/pkgs/development/python-modules/pyqt/5.x.nix index 3b98b5738825f..f6b84972324b4 100644 --- a/pkgs/development/python-modules/pyqt/5.x.nix +++ b/pkgs/development/python-modules/pyqt/5.x.nix @@ -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; { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 223f872aaf7ae..2d4e39346643b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -28229,9 +28229,7 @@ with pkgs; wrapQemuBinfmtP = callPackage ../applications/virtualization/qemu/binfmt-p-wrapper.nix { }; - qgis-unwrapped = libsForQt5.callPackage ../applications/gis/qgis/unwrapped.nix { - withGrass = false; - }; + qgis-ltr = callPackage ../applications/gis/qgis/ltr.nix { }; qgis = callPackage ../applications/gis/qgis { };