-
-
Notifications
You must be signed in to change notification settings - Fork 311
/
package.nix
160 lines (143 loc) · 3.03 KB
/
package.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
{ lib
, stdenv
, makeWrapper
, wrapGAppsHook
, withOpenGL ? true
, bison
, blas
, cairo
, ffmpeg
, fftw
, flex
, freetype
, gdal
, geos
, lapack
, libGLU
, libiconv
, libpng
, libsvm
, libtiff
, libxml2
, netcdf
, pdal
, pkg-config
, postgresql
, proj
, python311Packages
, readline
, sqlite
, wxGTK32
, zlib
, zstd
}:
let
pyPackages = python311Packages;
in
stdenv.mkDerivation (finalAttrs: {
pname = "grass";
version = "dev";
src = lib.cleanSourceWith {
src = ./.;
filter = (
path: type: (builtins.all (x: x != baseNameOf path) [
".git"
".github"
"flake.nix"
"package.nix"
])
);
};
nativeBuildInputs = [
makeWrapper
wrapGAppsHook
bison
flex
gdal # for `gdal-config`
geos # for `geos-config`
netcdf # for `nc-config`
pkg-config
] ++ (with pyPackages; [ python-dateutil numpy wxpython ]);
buildInputs = [
blas
cairo
ffmpeg
fftw
freetype
gdal
geos
lapack
libpng
libsvm
libtiff
(libxml2.override { enableHttp = true; })
netcdf
pdal
postgresql
proj
readline
sqlite
wxGTK32
zlib
zstd
] ++ lib.optionals withOpenGL [ libGLU ]
++ lib.optionals stdenv.isDarwin [ libiconv ];
strictDeps = true;
configureFlags = [
"--with-blas"
"--with-cairo-ldflags=-lfontconfig"
"--with-cxx"
"--with-fftw"
"--with-freetype"
"--with-gdal"
"--with-geos"
"--with-lapack"
"--with-libsvm"
"--with-nls"
"--with-openmp"
"--with-pdal"
"--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-sqlite"
"--with-zstd"
"--without-bzlib"
"--without-mysql"
"--without-odbc"
] ++ lib.optionals (! withOpenGL) [
"--without-opengl"
] ++ lib.optionals stdenv.isDarwin [
"--without-cairo"
"--without-freetype"
"--without-x"
];
# Otherwise a very confusing "Can't load GDAL library" error
makeFlags = lib.optional stdenv.isDarwin "GDAL_DYNAMIC=";
# Ensures that the python scripts running at build time are actually
# executable; otherwise, patchShebangs ignores them.
postConfigure = ''
for f in $(find . -name '*.py'); do
chmod +x $f
done
patchShebangs */
'';
postInstall = ''
wrapProgram $out/bin/grass \
--set PYTHONPATH $PYTHONPATH \
--set GRASS_PYTHON ${pyPackages.python.interpreter} \
--suffix LD_LIBRARY_PATH ':' '${gdal}/lib'
ln -s $out/grass*/lib $out/lib
ln -s $out/grass*/include $out/include
'';
enableParallelBuilding = true;
meta = with lib; {
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;
platforms = platforms.all;
mainProgram = "grass";
};
})