2019-10-05 07:46:51 +00:00
|
|
|
{ stdenv
|
|
|
|
, buildGoPackage
|
2020-03-27 07:33:21 +00:00
|
|
|
, lib
|
2019-10-05 07:46:51 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, buildGoModule
|
|
|
|
, packr
|
|
|
|
, sqlite
|
|
|
|
, callPackage
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "gotify-server";
|
2020-04-27 13:23:33 +00:00
|
|
|
# should be update just like all other files imported like that via the
|
|
|
|
# `update.sh` script.
|
|
|
|
version = import ./version.nix;
|
2019-10-05 07:46:51 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gotify";
|
|
|
|
repo = "server";
|
|
|
|
rev = "v${version}";
|
2020-04-27 13:23:33 +00:00
|
|
|
sha256 = import ./source-sha.nix;
|
2019-10-05 07:46:51 +00:00
|
|
|
};
|
|
|
|
|
2020-05-01 01:59:00 +00:00
|
|
|
vendorSha256 = "1ha0zgz1n07sd3if6823fi83j7yajysjdzfbwqk9rpsi6zv3cfh3";
|
2019-10-05 07:46:51 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace app.go \
|
|
|
|
--replace 'Version = "unknown"' 'Version = "${version}"'
|
|
|
|
'';
|
|
|
|
|
2020-03-27 07:33:21 +00:00
|
|
|
buildInputs = [ sqlite ];
|
2019-10-05 07:46:51 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ packr ];
|
|
|
|
|
|
|
|
ui = callPackage ./ui.nix { };
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
cp -r ${ui}/libexec/gotify-ui/deps/gotify-ui/build ui/build && packr
|
|
|
|
'';
|
|
|
|
|
2020-05-10 20:12:41 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = ./update.sh;
|
|
|
|
};
|
|
|
|
|
2019-10-05 07:46:51 +00:00
|
|
|
# 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;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|