Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions pkgs/applications/gis/grass/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/"
Expand All @@ -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
Expand All @@ -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 \
Expand All @@ -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
Expand Down
14 changes: 10 additions & 4 deletions pkgs/applications/gis/qgis/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,5 +27,7 @@ symlinkJoin rec {
--set PYTHONPATH $program_PYTHONPATH
'';

passthru.unwrapped = qgis-unwrapped;

meta = qgis-unwrapped.meta;
}
32 changes: 32 additions & 0 deletions pkgs/applications/gis/qgis/ltr.nix
Original file line number Diff line number Diff line change
@@ -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;
}
148 changes: 148 additions & 0 deletions pkgs/applications/gis/qgis/unwrapped-ltr.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
}
Loading