3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/servers/gotify/default.nix
2020-05-14 07:22:21 +01:00

62 lines
1.4 KiB
Nix

{ stdenv
, buildGoPackage
, lib
, fetchFromGitHub
, buildGoModule
, packr
, sqlite
, callPackage
}:
buildGoModule rec {
pname = "gotify-server";
# should be update just like all other files imported like that via the
# `update.sh` script.
version = import ./version.nix;
src = fetchFromGitHub {
owner = "gotify";
repo = "server";
rev = "v${version}";
sha256 = import ./source-sha.nix;
};
vendorSha256 = "1ha0zgz1n07sd3if6823fi83j7yajysjdzfbwqk9rpsi6zv3cfh3";
postPatch = ''
substituteInPlace app.go \
--replace 'Version = "unknown"' 'Version = "${version}"'
'';
buildInputs = [ sqlite ];
nativeBuildInputs = [ packr ];
ui = callPackage ./ui.nix { };
preBuild = ''
cp -r ${ui}/libexec/gotify-ui/deps/gotify-ui/build ui/build && packr
'';
passthru = {
updateScript = ./update.sh;
};
# 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;
};
}