From 4a559f8fee64bf8dc6017d66667eb42e778f819e Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 12 Sep 2020 19:02:09 +0200 Subject: [PATCH] gotify-server: fix UI In version 2.0.15 `gotify` switched to `packr` at 2.x which is why the UI can't be served properly via HTTP and causes an empty 500 response and the following errors in `journald`: ``` 2020/09/12 19:18:33 [Recovery] 2020/09/12 - 19:18:33 panic recovered: GET / HTTP/1.1 Host: localhost:8080 Accept: */* User-Agent: curl/7.72.0 stat /home/ma27/Projects/ui/build/index.html: no such file or directory ``` This wasn't caught by the VM-test as it only tested the REST and push APIs. Using their internal `packr.go` script in our build as it's the case in the upstream build-system[1] fixes the issue. [1] https://github.com/gotify/server/pull/277/files#diff-b67911656ef5d18c4ae36cb6741b7965R48 --- nixos/tests/gotify-server.nix | 5 +++++ pkgs/servers/gotify/default.nix | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/nixos/tests/gotify-server.nix b/nixos/tests/gotify-server.nix index c6e00686aed..c0b8ba43548 100644 --- a/nixos/tests/gotify-server.nix +++ b/nixos/tests/gotify-server.nix @@ -41,5 +41,10 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : { ) assert title == "Gotify" + + # Ensure that the UI responds with a successfuly code and that the + # response is not empty + result = machine.succeed("curl -fsS localhost:3000") + assert result, "HTTP response from localhost:3000 must not be empty!" ''; }) diff --git a/pkgs/servers/gotify/default.nix b/pkgs/servers/gotify/default.nix index 88617d0cd8b..4360ac95b0b 100644 --- a/pkgs/servers/gotify/default.nix +++ b/pkgs/servers/gotify/default.nix @@ -3,7 +3,6 @@ , lib , fetchFromGitHub , buildGoModule -, packr , sqlite , callPackage }: @@ -32,12 +31,10 @@ buildGoModule rec { buildInputs = [ sqlite ]; - nativeBuildInputs = [ packr ]; - ui = callPackage ./ui.nix { }; preBuild = '' - cp -r ${ui}/libexec/gotify-ui/deps/gotify-ui/build ui/build && packr + cp -r ${ui}/libexec/gotify-ui/deps/gotify-ui/build ui/build && go run hack/packr/packr.go ''; passthru = {