about summary refs log tree commit diff
path: root/pkgs/applications/gis
diff options
context:
space:
mode:
authorGuillaume Girol <symphorien@users.noreply.github.com>2023-07-14 14:36:49 +0000
committerGitHub <noreply@github.com>2023-07-14 14:36:49 +0000
commit4774ffce45f6b9f1ec9b8ce636b6f4b85650e142 (patch)
treeffccb5d715e0fbe8b0512f495f7383d4567eda3c /pkgs/applications/gis
parent6262b10ef167564e3d2dd6db8a85f9b836c87292 (diff)
parent79dffec139fdfc7d086e360762f1815b86eae7c4 (diff)
Merge pull request #241164 from imincik/grass-ordering-cleanup
grass: alphabetical reordering of dependencies and adding package tests
Diffstat (limited to 'pkgs/applications/gis')
-rw-r--r--pkgs/applications/gis/grass/default.nix101
-rw-r--r--pkgs/applications/gis/grass/tests.nix18
2 files changed, 93 insertions, 26 deletions
diff --git a/pkgs/applications/gis/grass/default.nix b/pkgs/applications/gis/grass/default.nix
index 19b42b6b7ad7d..0d16ba036a9c6 100644
--- a/pkgs/applications/gis/grass/default.nix
+++ b/pkgs/applications/gis/grass/default.nix
@@ -1,10 +1,38 @@
-{ lib, stdenv, fetchFromGitHub, flex, bison, pkg-config, zlib, libtiff, libpng, fftw
-, cairo, readline, ffmpeg, makeWrapper, wxGTK32, libiconv, libxml2, netcdf, blas
-, proj, gdal, geos, sqlite, postgresql, libmysqlclient, python3Packages, proj-datumgrid
-, zstd, pdal, wrapGAppsHook
+{ lib
+, stdenv
+, callPackage
+, fetchFromGitHub
+, makeWrapper
+, wrapGAppsHook
+
+, bison
+, blas
+, cairo
+, ffmpeg
+, fftw
+, flex
+, gdal
+, geos
+, libiconv
+, libmysqlclient
+, libpng
+, libtiff
+, libxml2
+, netcdf
+, pdal
+, pkg-config
+, postgresql
+, proj
+, proj-datumgrid
+, python3Packages
+, readline
+, sqlite
+, wxGTK32
+, zlib
+, zstd
 }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: rec {
   pname = "grass";
   version = "8.3.0";
 
@@ -16,22 +44,39 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [
-    pkg-config bison flex makeWrapper wrapGAppsHook
+    makeWrapper
+    wrapGAppsHook
+
+    bison
+    flex
     gdal # for `gdal-config`
     geos # for `geos-config`
-    netcdf # for `nc-config`
     libmysqlclient # for `mysql_config`
+    netcdf # for `nc-config`
+    pkg-config
   ] ++ (with python3Packages; [ python-dateutil numpy wxPython_4_2 ]);
 
   buildInputs = [
-    cairo zlib proj libtiff libpng libxml2 fftw sqlite
-    readline ffmpeg postgresql blas wxGTK32
-    proj-datumgrid zstd
+    blas
+    cairo
+    ffmpeg
+    fftw
     gdal
     geos
-    netcdf
     libmysqlclient
+    libpng
+    libtiff
+    libxml2
+    netcdf
     pdal
+    postgresql
+    proj
+    proj-datumgrid
+    readline
+    sqlite
+    wxGTK32
+    zlib
+    zstd
   ] ++ lib.optionals stdenv.isDarwin [ libiconv ];
 
   strictDeps = true;
@@ -46,24 +91,24 @@ stdenv.mkDerivation rec {
   '';
 
   configureFlags = [
-    "--with-proj-share=${proj}/share/proj"
-    "--with-proj-includes=${proj.dev}/include"
-    "--with-proj-libs=${proj}/lib"
-    "--without-opengl"
-    "--with-readline"
-    "--with-wxwidgets"
-    "--with-netcdf"
+    "--with-blas"
+    "--with-fftw"
     "--with-geos"
-    "--with-postgres"
-    "--with-postgres-libs=${postgresql.lib}/lib/"
-    # it complains about missing libmysqld but doesn't really seem to need it
+    # It complains about missing libmysqld but doesn't really seem to need it
     "--with-mysql"
     "--with-mysql-includes=${lib.getDev libmysqlclient}/include/mysql"
     "--with-mysql-libs=${libmysqlclient}/lib/mysql"
-    "--with-blas"
-    "--with-zstd"
-    "--with-fftw"
+    "--with-netcdf"
+    "--with-postgres"
+    "--with-postgres-libs=${postgresql.lib}/lib/"
+    "--with-proj-includes=${proj.dev}/include"
+    "--with-proj-libs=${proj}/lib"
+    "--with-proj-share=${proj}/share/proj"
     "--with-pthread"
+    "--with-readline"
+    "--with-wxwidgets"
+    "--with-zstd"
+    "--without-opengl"
   ] ++ lib.optionals stdenv.isLinux [
     "--with-pdal"
   ] ++ lib.optionals stdenv.isDarwin [
@@ -96,11 +141,15 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  passthru.tests = {
+    grass = callPackage ./tests.nix { grass = finalAttrs.finalPackage; };
+  };
+
   meta = with lib; {
-    homepage = "https://grass.osgeo.org/";
     description = "GIS software suite used for geospatial data management and analysis, image processing, graphics and maps production, spatial modeling, and visualization";
+    homepage = "https://grass.osgeo.org/";
     license = licenses.gpl2Plus;
     maintainers = with maintainers; teams.geospatial.members ++ [ mpickering ];
     platforms = platforms.all;
   };
-}
+})
diff --git a/pkgs/applications/gis/grass/tests.nix b/pkgs/applications/gis/grass/tests.nix
new file mode 100644
index 0000000000000..1a38d07de7891
--- /dev/null
+++ b/pkgs/applications/gis/grass/tests.nix
@@ -0,0 +1,18 @@
+{ runCommand, grass }:
+
+let
+  inherit (grass) pname version;
+
+in
+runCommand "${pname}-tests" { meta.timeout = 60; }
+  ''
+    HOME=$(mktemp -d)
+
+    ${grass}/bin/grass --tmp-location EPSG:3857 --exec g.version \
+      | grep 'GRASS ${version}'
+
+    ${grass}/bin/grass --tmp-location EPSG:3857 --exec g.mapset -l \
+      | grep 'PERMANENT'
+
+    touch $out
+  ''