1{
2 lib,
3 fetchFromGitHub,
4 buildGoModule,
5}:
6
7buildGoModule rec {
8 pname = "pg_featureserv";
9 version = "1.3.1";
10
11 src = fetchFromGitHub {
12 owner = "CrunchyData";
13 repo = "pg_featureserv";
14 rev = "v${version}";
15 sha256 = "sha256-GsloUZFgrOrJc23vKv+8iSeyIEKblaukPSCpZGRtSL4=";
16 };
17
18 vendorHash = "sha256-BHiEVyi3FXPovYy3iDP8q+y+LgfI4ElDPVZexd7nnuo=";
19
20 postPatch = ''
21 # fix default configuration file location
22 substituteInPlace \
23 internal/conf/config.go \
24 --replace-fail "viper.AddConfigPath(\"/etc\")" "viper.AddConfigPath(\"$out/share/config\")"
25
26 # fix assets location in configuration file
27 substituteInPlace \
28 config/pg_featureserv.toml.example \
29 --replace-fail "AssetsPath = \"./assets\"" "AssetsPath = \"$out/share/assets\""
30 '';
31
32 ldflags = [
33 "-s"
34 "-w"
35 "-X github.com/CrunchyData/pg_featureserv/conf.setVersion=${version}"
36 ];
37
38 postInstall = ''
39 mkdir -p $out/share
40 cp -r assets $out/share
41
42 mkdir -p $out/share/config
43 cp config/pg_featureserv.toml.example $out/share/config/pg_featureserv.toml
44 '';
45
46 meta = with lib; {
47 description = "Lightweight RESTful Geospatial Feature Server for PostGIS in Go";
48 mainProgram = "pg_featureserv";
49 homepage = "https://github.com/CrunchyData/pg_featureserv";
50 license = licenses.asl20;
51 teams = [ teams.geospatial ];
52 };
53}