-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
242 lines (209 loc) · 7.82 KB
/
flake.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
{
description = "Rolling geospatial packages repository and Nix overlay";
nixConfig = {
extra-substituters = [ "https://geonix-rolling.cachix.org" ];
extra-trusted-public-keys = [ "geonix-rolling.cachix.org-1:27FqadR8Jqcwl+OY7+JvhRJoWixjMwX8xrwc6kIBnDo=" ];
bash-prompt = "\\[\\033[1m\\][geonix]\\[\\033\[m\\]\\040\\w >\\040";
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
nixgl = {
url = "github:nix-community/nixGL";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ ];
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, ... }: {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ self.overlays.geonix ];
config.allowUnfree = true;
};
# Packages
packages =
{
# Libs
gdal = pkgs.gdal;
gdal-minimal = pkgs.gdalMinimal;
gdal-master = pkgs.gdal-master;
geos = pkgs.geos;
libgeotiff = pkgs.libgeotiff;
libLAS = pkgs.libLAS;
libosmium = pkgs.libosmium;
librttopo = pkgs.librttopo;
libspatialindex = pkgs.libspatialindex;
libspatialite = pkgs.libspatialite;
libtiff = pkgs.libtiff;
pdal = pkgs.pdal;
proj = pkgs.proj;
shapelib = pkgs.shapelib;
# Python packages
python3-fiona = pkgs.python3Packages.fiona;
python3-gdal = pkgs.python3Packages.gdal;
python3-geopandas = pkgs.python3Packages.geopandas;
python3-owslib = pkgs.python3Packages.owslib;
python3-psycopg = pkgs.python3Packages.psycopg;
python3-pyogrio = pkgs.python3Packages.pyogrio;
python3-pyproj = pkgs.python3Packages.pyproj;
python3-pystac = pkgs.python3Packages.pystac;
python3-rasterio = pkgs.python3Packages.rasterio;
python3-shapely = pkgs.python3Packages.shapely;
# PostgreSQL packages
postgresql-postgis = pkgs.postgresqlPackages.postgis;
# Tools
dcw-gmt = pkgs.dcw-gmt;
entwine = pkgs.entwine;
gmt = pkgs.gmt;
gshhg-gmt = pkgs.gshhg-gmt;
ili2c = pkgs.ili2c;
LAStools = pkgs.LAStools;
mapnik = pkgs.mapnik;
osm2pgsql = pkgs.osm2pgsql;
osmium-tool = pkgs.osmium-tool;
pmtiles = pkgs.pmtiles;
protozero = pkgs.protozero;
tippecanoe = pkgs.tippecanoe;
# Apps
grass = pkgs.grass;
openjump = pkgs.openjump;
qgis = pkgs.qgis;
qgis-ltr = pkgs.qgis-ltr;
saga = pkgs.saga;
spatialite-gui = pkgs.spatialite_gui; # FIXME: rename in nixpkgs
# Services
geoserver = pkgs.geoserver;
mapcache = pkgs.mapcache;
mapproxy = pkgs.mapserver;
mapserver = pkgs.mapserver;
mbtileserver = pkgs.mbtileserver;
pg_featureserv = pkgs.pg_featureserv;
pg_tileserv = pkgs.pg_tileserv;
tegola = pkgs.tegola;
tile38 = pkgs.tile38;
# t-rex = pkgs.t-rex;
# Other
nixGL = pkgs.nixGL;
# Meta packages
all-packages = pkgs.symlinkJoin {
name = "all-packages";
paths = pkgs.lib.attrValues (pkgs.lib.filterAttrs (n: v: n != "all-packages") self'.packages);
};
}
// (pkgs.lib.mapAttrs'
(
name: value: { name = "grass-plugin-" + name; value = value; }
)
pkgs.grassPlugins)
// (pkgs.lib.mapAttrs'
(
name: value: { name = "qgis-plugin-" + name; value = value; }
)
pkgs.qgisPlugins)
// (pkgs.lib.mapAttrs'
(
name: value: { name = "qgis-ltr-plugin-" + name; value = value; }
)
pkgs.qgisLTRPlugins);
# Shells
devShells = import ./shells.nix { inherit self' pkgs; };
# Checks
checks = import ./checks.nix { inherit self' pkgs; nixpkgs = inputs.nixpkgs; };
};
flake =
let
lib = inputs.nixpkgs.lib;
recurseIntoOverlayAttrs = overlay:
final: prev:
let
recurse = lib.mapAttrs (
name: value:
if lib.isAttrs value && ! lib.isDerivation value && ! prev ? ${name} then
lib.recurseIntoAttrs (recurse value)
else
value
);
in
recurse (overlay final prev);
in
{
overlays.geonix =
final: prev:
{
# Example package override
# gdal = prev.gdal.overrideAttrs (prev: { version = "1000"; });
# gdalMinimal = prev.gdal.overrideAttrs
# (prev: {
# useMinimalFeatures = true;
# });
# Default Python version
# python3Packages = prev.python311Packages;
# python3 = prev.python311;
# Default PostgreSQL version
# postgresqlPackages = prev.postgresql15Packages;
# postgresql = prev.postgresql_15;
# grass
grass = prev.grass.overrideAttrs (prev: {
patches = [
# Backport of https://github.com/OSGeo/grass/pull/3899
# by @landam . Remove for GRASS 8.5.
./pkgs/grass/grass_config_dir.patch
];
});
# gdal
gdal-master = (final.pkgs.callPackage ./pkgs/gdal/master.nix { }).master;
gdal-minimal = final.pkgs.gdalMinimal;
# grass plugins
grassPlugins =
let
plugins = import ./pkgs/grass/plugins-list.nix;
in
final.lib.mapAttrs'
(
name: value: {
name = name;
value = final.callPackage ./pkgs/grass/plugins.nix {
name = name;
plugin = value;
};
}
)
plugins;
# qgis plugins
qgisPlugins =
let
plugins = import ./pkgs/qgis/qgis-plugins-list.nix;
in
final.lib.mapAttrs'
(
name: value: {
name = name;
value = final.callPackage ./pkgs/qgis/plugins.nix { name = name; plugin = value; };
}
)
plugins;
qgisLTRPlugins =
let
plugins = import ./pkgs/qgis/qgis-ltr-plugins-list.nix;
in
final.lib.mapAttrs'
(
name: value: {
name = name;
value = final.callPackage ./pkgs/qgis/plugins.nix { name = name; plugin = value; };
}
)
plugins;
# nixGL
nixGL = inputs.nixgl.packages.${prev.stdenv.hostPlatform.system}.nixGLIntel;
};
# legacyPackages output used for nix search
legacyPackages.x86_64-linux = inputs.nixpkgs.legacyPackages.x86_64-linux.extend (
recurseIntoOverlayAttrs self.overlays.geonix
);
};
};
}