2024-02-29 20:09:43 +00:00
|
|
|
{ lib, fetchFromGitHub, buildGoModule }:
|
2020-10-16 20:44:37 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "pg_tileserv";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "1.0.11";
|
2020-10-16 20:44:37 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "CrunchyData";
|
2023-08-04 22:07:22 +00:00
|
|
|
repo = "pg_tileserv";
|
2020-10-16 20:44:37 +00:00
|
|
|
rev = "v${version}";
|
2024-02-07 01:22:34 +00:00
|
|
|
hash = "sha256-xTIx39eLmHBUlaUjQy9KGpi5X4AU93DzX+Ofg5PMLWE=";
|
2020-10-16 20:44:37 +00:00
|
|
|
};
|
|
|
|
|
2024-02-07 01:22:34 +00:00
|
|
|
vendorHash = "sha256-8CvYvoIKOYvR7npCV65ZqZGR8KCTH4GabTt/JGQG3uc=";
|
2020-12-07 07:45:13 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
postPatch = ''
|
|
|
|
# fix default configuration file location
|
|
|
|
substituteInPlace \
|
|
|
|
main.go \
|
|
|
|
--replace-fail "viper.AddConfigPath(\"/etc\")" "viper.AddConfigPath(\"$out/share/config\")"
|
|
|
|
|
|
|
|
# fix assets location in configuration file
|
|
|
|
substituteInPlace \
|
|
|
|
config/pg_tileserv.toml.example \
|
|
|
|
--replace-fail "# AssetsPath = \"/usr/share/pg_tileserv/assets\"" "AssetsPath = \"$out/share/assets\""
|
|
|
|
'';
|
|
|
|
|
2021-08-27 14:25:00 +00:00
|
|
|
ldflags = [ "-s" "-w" "-X main.programVersion=${version}" ];
|
2020-10-16 20:44:37 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share
|
|
|
|
cp -r assets $out/share
|
|
|
|
|
|
|
|
mkdir -p $out/share/config
|
|
|
|
cp config/pg_tileserv.toml.example $out/share/config/pg_tileserv.toml
|
|
|
|
'';
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Very thin PostGIS-only tile server in Go";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "pg_tileserv";
|
2020-10-16 20:44:37 +00:00
|
|
|
homepage = "https://github.com/CrunchyData/pg_tileserv";
|
|
|
|
license = licenses.asl20;
|
2024-01-02 11:29:13 +00:00
|
|
|
maintainers = teams.geospatial.members;
|
2020-10-16 20:44:37 +00:00
|
|
|
};
|
|
|
|
}
|