diff --git a/pkgs/applications/gis/gmt/dcw.nix b/pkgs/by-name/dc/dcw-gmt/package.nix similarity index 87% rename from pkgs/applications/gis/gmt/dcw.nix rename to pkgs/by-name/dc/dcw-gmt/package.nix index 092e86edcb66..efa697b2926a 100644 --- a/pkgs/applications/gis/gmt/dcw.nix +++ b/pkgs/by-name/dc/dcw-gmt/package.nix @@ -1,10 +1,14 @@ -{ lib, stdenv, fetchurl }: +{ + lib, + stdenv, + fetchurl, +}: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "dcw-gmt"; version = "2.1.2"; src = fetchurl { - url = "ftp://ftp.soest.hawaii.edu/gmt/dcw-gmt-${version}.tar.gz"; + url = "ftp://ftp.soest.hawaii.edu/gmt/dcw-gmt-${finalAttrs.version}.tar.gz"; sha256 = "sha256-S7hA0HXIuj4UrrQc8XwkI2v/eHVmMU+f91irmXd0XZk="; }; @@ -29,4 +33,4 @@ stdenv.mkDerivation rec { maintainers = lib.teams.geospatial.members ++ (with lib.maintainers; [ tviti ]); }; -} +}) diff --git a/pkgs/applications/gis/gmt/default.nix b/pkgs/by-name/gm/gmt/package.nix similarity index 65% rename from pkgs/applications/gis/gmt/default.nix rename to pkgs/by-name/gm/gmt/package.nix index 2f2528ff5bb9..afd1464aeba6 100644 --- a/pkgs/applications/gis/gmt/default.nix +++ b/pkgs/by-name/gm/gmt/package.nix @@ -1,15 +1,12 @@ { lib, stdenv, - fetchFromGitHub, + fetchurl, cmake, curl, - Accelerate, - CoreGraphics, - CoreVideo, + darwin, fftwSinglePrec, netcdf, - libxml2, pcre, gdal, blas, @@ -19,46 +16,34 @@ dcw-gmt, gshhg-gmt, }: - /* The onus is on the user to also install: - ffmpeg for webm or mp4 output - graphicsmagick for gif output */ -let - # Certainly not an ideal situation, See: - # https://github.com/NixOS/nixpkgs/pull/340707#issuecomment-2361894717 - netcdf' = netcdf.override { - libxml2 = libxml2.override { - enableHttp = true; - }; - }; -in stdenv.mkDerivation (finalAttrs: { +stdenv.mkDerivation (finalAttrs: { pname = "gmt"; - version = "6.5.0"; - src = fetchFromGitHub { - owner = "GenericMappingTools"; - repo = "gmt"; - rev = "refs/tags/${finalAttrs.version}"; - hash = "sha256-KKIYhljCtk9t9CuvTLsSGvUkUwazWTm9ymBB3wLwSoI="; + version = "6.4.0"; + src = fetchurl { + url = "https://github.com/GenericMappingTools/gmt/releases/download/${finalAttrs.version}/gmt-${finalAttrs.version}-src.tar.gz"; + sha256 = "sha256-0mfAx9b7MMnqfgKe8n2tsm/9e5LLS0cD+aO6Do85Ohs="; }; - nativeBuildInputs = [ - cmake - ]; + nativeBuildInputs = [ cmake ]; buildInputs = [ curl gdal - netcdf' + netcdf pcre dcw-gmt gshhg-gmt ] ++ ( - if stdenv.hostPlatform.isDarwin then + if stdenv.isDarwin then + with darwin.apple_sdk.frameworks; [ Accelerate CoreGraphics @@ -73,9 +58,7 @@ in stdenv.mkDerivation (finalAttrs: { ] ); - propagatedBuildInputs = [ - ghostscript - ]; + propagatedBuildInputs = [ ghostscript ]; cmakeFlags = [ @@ -86,13 +69,24 @@ in stdenv.mkDerivation (finalAttrs: { "-DGSHHG_ROOT=${gshhg-gmt.out}/share/gshhg-gmt" "-DCOPY_DCW:BOOL=FALSE" "-DDCW_ROOT=${dcw-gmt.out}/share/dcw-gmt" + "-DGDAL_ROOT=${gdal.out}" + "-DNETCDF_ROOT=${netcdf.out}" + "-DPCRE_ROOT=${pcre.out}" "-DGMT_INSTALL_TRADITIONAL_FOLDERNAMES:BOOL=FALSE" "-DGMT_ENABLE_OPENMP:BOOL=TRUE" "-DGMT_INSTALL_MODULE_LINKS:BOOL=FALSE" "-DLICENSE_RESTRICTED=LGPL" # "GPL" and "no" also valid - ]; + ] + ++ ( + with stdenv; + lib.optionals (!isDarwin) [ + "-DFFTW3_ROOT=${fftwSinglePrec.dev}" + "-DLAPACK_LIBRARY=${lapack}/lib/liblapack.so" + "-DBLAS_LIBRARY=${blas}/lib/libblas.so" + ] + ); - meta = { + meta = with lib; { homepage = "https://www.generic-mapping-tools.org"; description = "Tools for manipulating geographic and cartesian data sets"; longDescription = '' @@ -104,9 +98,11 @@ in stdenv.mkDerivation (finalAttrs: { transformations and includes supporting data such as coastlines, rivers, and political boundaries and optionally country polygons. ''; - platforms = lib.platforms.unix; - license = lib.licenses.lgpl3Plus; - maintainers = lib.teams.geospatial.members ++ (with lib.maintainers; [ tviti ]); + platforms = [ + "x86_64-linux" + "x86_64-darwin" + ]; + license = licenses.lgpl3Plus; + maintainers = with maintainers; [ tviti ]; }; - }) diff --git a/pkgs/applications/gis/gmt/gshhg.nix b/pkgs/by-name/gs/gshhg-gmt/package.nix similarity index 86% rename from pkgs/applications/gis/gmt/gshhg.nix rename to pkgs/by-name/gs/gshhg-gmt/package.nix index d51f1dbbcb5a..c17378d5ec1b 100644 --- a/pkgs/applications/gis/gmt/gshhg.nix +++ b/pkgs/by-name/gs/gshhg-gmt/package.nix @@ -1,10 +1,14 @@ -{ lib, stdenv, fetchurl }: +{ + lib, + stdenv, + fetchurl, +}: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "gshhg-gmt"; version = "2.3.7"; src = fetchurl { - url = "ftp://ftp.soest.hawaii.edu/gmt/gshhg-gmt-${version}.tar.gz"; + url = "ftp://ftp.soest.hawaii.edu/gmt/gshhg-gmt-${finalAttrs.version}.tar.gz"; sha256 = "9bb1a956fca0718c083bef842e625797535a00ce81f175df08b042c2a92cfe7f"; }; @@ -28,4 +32,4 @@ stdenv.mkDerivation rec { maintainers = lib.teams.geospatial.members ++ (with lib.maintainers; [ tviti ]); }; -} +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 082c351099b5..bd496238d27c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -27779,15 +27779,6 @@ with pkgs; ### APPLICATIONS / GIS - gmt = callPackage ../applications/gis/gmt { - inherit (darwin.apple_sdk.frameworks) - Accelerate CoreGraphics CoreVideo; - }; - - gshhg-gmt = callPackage ../applications/gis/gmt/gshhg.nix { }; - - dcw-gmt = callPackage ../applications/gis/gmt/dcw.nix { }; - grass = callPackage ../applications/gis/grass { stdenv = if stdenv.hostPlatform.isDarwin then overrideSDK stdenv "11.0" else stdenv; };