Merge pull request #330634 from r-ryantm/auto-update/circumflex
[NixPkgs.git] / pkgs / servers / geospatial / pg_featureserv / default.nix
blobdf7bba48abe631ceeddc9bb341b64ede849b34d4
1 { lib, fetchFromGitHub, buildGoModule }:
3 buildGoModule rec {
4   pname = "pg_featureserv";
5   version = "1.3.1";
7   src = fetchFromGitHub {
8     owner = "CrunchyData";
9     repo = pname;
10     rev = "v${version}";
11     sha256 = "sha256-GsloUZFgrOrJc23vKv+8iSeyIEKblaukPSCpZGRtSL4=";
12   };
14   vendorHash = "sha256-BHiEVyi3FXPovYy3iDP8q+y+LgfI4ElDPVZexd7nnuo=";
16   postPatch = ''
17     # fix default configuration file location
18     substituteInPlace \
19       internal/conf/config.go \
20       --replace-fail "viper.AddConfigPath(\"/etc\")" "viper.AddConfigPath(\"$out/share/config\")"
22     # fix assets location in configuration file
23     substituteInPlace \
24       config/pg_featureserv.toml.example \
25       --replace-fail "AssetsPath = \"./assets\"" "AssetsPath = \"$out/share/assets\""
26   '';
28   ldflags = [ "-s" "-w" "-X github.com/CrunchyData/pg_featureserv/conf.setVersion=${version}" ];
30   postInstall = ''
31     mkdir -p $out/share
32     cp -r assets $out/share
34     mkdir -p $out/share/config
35     cp config/pg_featureserv.toml.example $out/share/config/pg_featureserv.toml
36   '';
38   meta = with lib; {
39     description = "Lightweight RESTful Geospatial Feature Server for PostGIS in Go";
40     mainProgram = "pg_featureserv";
41     homepage = "https://github.com/CrunchyData/pg_featureserv";
42     license = licenses.asl20;
43     maintainers = teams.geospatial.members;
44   };