2019-10-05 09:46:51 +02:00
|
|
|
{ stdenv
|
|
|
|
, buildGoPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildGoModule
|
|
|
|
, packr
|
|
|
|
, sqlite
|
|
|
|
, callPackage
|
2020-03-21 12:11:00 +01:00
|
|
|
, Security
|
2019-10-05 09:46:51 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "gotify-server";
|
2019-11-26 21:45:31 +01:00
|
|
|
# Note that when this is updated, along with the hash, the `ui.nix` file
|
|
|
|
# should include the same changes to the version and the sha256.
|
2020-02-19 11:38:31 +01:00
|
|
|
version = "2.0.14";
|
2019-10-05 09:46:51 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gotify";
|
|
|
|
repo = "server";
|
|
|
|
rev = "v${version}";
|
2020-02-19 11:38:31 +01:00
|
|
|
sha256 = "0hyy9fki2626cgd78l7fkk67lik6g1pkcpf6xr3gl07dxwcclyr8";
|
2019-10-05 09:46:51 +02:00
|
|
|
};
|
|
|
|
|
2019-11-30 10:41:51 +01:00
|
|
|
modSha256 = "1awhbc8qs2bwv6y2vwd92r4ys0l1bzymrb36iamr040x961682wv";
|
2019-10-05 09:46:51 +02:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace app.go \
|
|
|
|
--replace 'Version = "unknown"' 'Version = "${version}"'
|
|
|
|
'';
|
|
|
|
|
2020-03-21 12:11:00 +01:00
|
|
|
buildInputs = [ sqlite ]
|
|
|
|
++ stdenv.lib.optionals stdenv.isDarwin [ Security ];
|
2019-10-05 09:46:51 +02:00
|
|
|
|
|
|
|
nativeBuildInputs = [ packr ];
|
|
|
|
|
|
|
|
ui = callPackage ./ui.nix { };
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
cp -r ${ui}/libexec/gotify-ui/deps/gotify-ui/build ui/build && packr
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Otherwise, all other subpackages are built as well and from some reason,
|
|
|
|
# produce binaries which panic when executed and are not interesting at all
|
|
|
|
subPackages = [ "." ];
|
|
|
|
|
|
|
|
buildFlagsArray = [
|
|
|
|
"-ldflags='-X main.Version=${version} -X main.Mode=prod'"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A simple server for sending and receiving messages in real-time per WebSocket";
|
|
|
|
homepage = "https://gotify.net";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ doronbehar ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|