about summary refs log tree commit diff
path: root/pkgs/servers
diff options
context:
space:
mode:
authorIvan Mincik <ivan.mincik@gmail.com>2024-02-23 16:39:04 +0100
committerIvan Mincik <ivan.mincik@gmail.com>2024-02-25 07:27:00 +0100
commit31d75ec2539fd4652b9bebd6bac9f23a45eba5e9 (patch)
treefb04f18674abaa06f923675729808342787704a5 /pkgs/servers
parentfe96ffa827ccef5476f10f5604e427ae7ee36e23 (diff)
downloadnixlib-31d75ec2539fd4652b9bebd6bac9f23a45eba5e9.tar
nixlib-31d75ec2539fd4652b9bebd6bac9f23a45eba5e9.tar.gz
nixlib-31d75ec2539fd4652b9bebd6bac9f23a45eba5e9.tar.bz2
nixlib-31d75ec2539fd4652b9bebd6bac9f23a45eba5e9.tar.lz
nixlib-31d75ec2539fd4652b9bebd6bac9f23a45eba5e9.tar.xz
nixlib-31d75ec2539fd4652b9bebd6bac9f23a45eba5e9.tar.zst
nixlib-31d75ec2539fd4652b9bebd6bac9f23a45eba5e9.zip
pg_featureserv: install assets and configuration file
Diffstat (limited to 'pkgs/servers')
-rw-r--r--pkgs/servers/geospatial/pg_featureserv/default.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/pkgs/servers/geospatial/pg_featureserv/default.nix b/pkgs/servers/geospatial/pg_featureserv/default.nix
index b6e68eb946e2..04a226650ac5 100644
--- a/pkgs/servers/geospatial/pg_featureserv/default.nix
+++ b/pkgs/servers/geospatial/pg_featureserv/default.nix
@@ -13,8 +13,28 @@ buildGoModule rec {
 
   vendorHash = "sha256-BHiEVyi3FXPovYy3iDP8q+y+LgfI4ElDPVZexd7nnuo=";
 
+  postPatch = ''
+    # fix default configuration file location
+    substituteInPlace \
+      internal/conf/config.go \
+      --replace-fail "viper.AddConfigPath(\"/etc\")" "viper.AddConfigPath(\"$out/share/config\")"
+
+    # fix assets location in configuration file
+    substituteInPlace \
+      config/pg_featureserv.toml.example \
+      --replace-fail "AssetsPath = \"./assets\"" "AssetsPath = \"$out/share/assets\""
+  '';
+
   ldflags = [ "-s" "-w" "-X github.com/CrunchyData/pg_featureserv/conf.setVersion=${version}" ];
 
+  postInstall = ''
+    mkdir -p $out/share
+    cp -r assets $out/share
+
+    mkdir -p $out/share/config
+    cp config/pg_featureserv.toml.example $out/share/config/pg_featureserv.toml
+  '';
+
   meta = with lib; {
     description = "Lightweight RESTful Geospatial Feature Server for PostGIS in Go";
     homepage = "https://github.com/CrunchyData/pg_featureserv";