about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/gis/qgis
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/gis/qgis')
-rw-r--r--nixpkgs/pkgs/applications/gis/qgis/default.nix27
-rw-r--r--nixpkgs/pkgs/applications/gis/qgis/unwrapped.nix54
2 files changed, 81 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/gis/qgis/default.nix b/nixpkgs/pkgs/applications/gis/qgis/default.nix
new file mode 100644
index 000000000000..0c76a489f13b
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/qgis/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, lib, makeWrapper, symlinkJoin
+, qgis-unwrapped, extraPythonPackages ? (ps: [ ])
+}:
+with lib;
+symlinkJoin rec {
+  inherit (qgis-unwrapped) version;
+  name = "qgis-${version}";
+
+  paths = [ qgis-unwrapped ];
+
+  nativeBuildInputs = [ makeWrapper qgis-unwrapped.python3Packages.wrapPython ];
+
+  # extend to add to the python environment of QGIS without rebuilding QGIS application.
+  pythonInputs = qgis-unwrapped.pythonBuildInputs ++ (extraPythonPackages qgis-unwrapped.python3Packages);
+
+  postBuild = ''
+    # unpackPhase
+
+    buildPythonPath "$pythonInputs"
+
+    wrapProgram $out/bin/qgis \
+      --prefix PATH : $program_PATH \
+      --set PYTHONPATH $program_PYTHONPATH
+  '';
+
+  meta = qgis-unwrapped.meta;
+}
diff --git a/nixpkgs/pkgs/applications/gis/qgis/unwrapped.nix b/nixpkgs/pkgs/applications/gis/qgis/unwrapped.nix
new file mode 100644
index 000000000000..e30f4a428a3e
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/qgis/unwrapped.nix
@@ -0,0 +1,54 @@
+{ stdenv, lib, fetchurl, cmake, ninja, flex, bison, proj, geos, xlibsWrapper, sqlite, gsl
+, qwt, fcgi, python3Packages, libspatialindex, libspatialite, postgresql
+, txt2tags, openssl, libzip, hdf5, netcdf
+, qtbase, qtwebkit, qtsensors, qca-qt5, qtkeychain, qscintilla, qtserialport, qtxmlpatterns
+, withGrass ? true, grass
+}:
+with lib;
+let
+  pythonBuildInputs = with python3Packages;
+    [ qscintilla-qt5 gdal jinja2 numpy psycopg2
+      chardet dateutil pyyaml pytz requests urllib3 pygments pyqt5 sip owslib six ];
+in stdenv.mkDerivation rec {
+  version = "3.4.5";
+  name = "qgis-unwrapped-${version}";
+
+  src = fetchurl {
+    url = "http://qgis.org/downloads/qgis-${version}.tar.bz2";
+    sha256 = "0myw1jgz8v8wncmrjsszn9ixylx84hafn0281c4hqhz623n3lxgx";
+  };
+
+  passthru = {
+    inherit pythonBuildInputs;
+    inherit python3Packages;
+  };
+
+  buildInputs = [ openssl proj geos xlibsWrapper sqlite gsl qwt
+    fcgi libspatialindex libspatialite postgresql txt2tags libzip hdf5 netcdf
+    qtbase qtwebkit qtsensors qca-qt5 qtkeychain qscintilla qtserialport qtxmlpatterns] ++
+    (stdenv.lib.optional withGrass grass) ++ pythonBuildInputs;
+
+  nativeBuildInputs = [ 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 'pyqtcfg.pyqt_sip_dir' '"${python3Packages.pyqt5}/share/sip/PyQt5"'
+   '';
+
+  cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=OFF"
+                 "-DPYQT5_SIP_DIR=${python3Packages.pyqt5}/share/sip/PyQt5"
+                 "-DQSCI_SIP_DIR=${python3Packages.qscintilla-qt5}/share/sip/PyQt5" ] ++
+                 stdenv.lib.optional withGrass "-DGRASS_PREFIX7=${grass}/${grass.name}";
+
+  meta = {
+    description = "A Free and Open Source Geographic Information System";
+    homepage = http://www.qgis.org;
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = with stdenv.lib.platforms; linux;
+    maintainers = with stdenv.lib.maintainers; [ lsix ];
+  };
+}