2021-01-23 08:47:37 +00:00
|
|
|
{ lib
|
2019-10-05 07:46:51 +00:00
|
|
|
, buildGoPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildGoModule
|
|
|
|
, sqlite
|
|
|
|
, callPackage
|
2023-09-06 03:07:18 +00:00
|
|
|
, nixosTests
|
2023-09-06 10:11:16 +00:00
|
|
|
, nix-update-script
|
2019-10-05 07:46:51 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "gotify-server";
|
2023-09-25 07:27:29 +00:00
|
|
|
version = "2.4.0";
|
2019-10-05 07:46:51 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gotify";
|
|
|
|
repo = "server";
|
|
|
|
rev = "v${version}";
|
2023-09-25 07:27:29 +00:00
|
|
|
hash = "sha256-TZeQcrJCH9TW039r499fxY4xJ27nZm9GdrilsI33Iqc=";
|
2019-10-05 07:46:51 +00:00
|
|
|
};
|
|
|
|
|
2020-11-30 21:16:14 +00:00
|
|
|
# With `allowGoReference = true;`, `buildGoModule` adds the `-trimpath`
|
|
|
|
# argument for Go builds which apparently breaks the UI like this:
|
|
|
|
#
|
|
|
|
# server[780]: stat /var/lib/private/ui/build/index.html: no such file or directory
|
|
|
|
allowGoReference = true;
|
|
|
|
|
2023-09-25 07:27:29 +00:00
|
|
|
vendorHash = "sha256-TR6YGNhSMQ/1kvX3p3QGlXovuoJdaRH0LOwIPZwQ/xY=";
|
2019-10-05 07:46:51 +00:00
|
|
|
|
2020-08-04 00:26:27 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2023-09-06 10:11:16 +00:00
|
|
|
buildInputs = [
|
|
|
|
sqlite
|
|
|
|
];
|
2019-10-05 07:46:51 +00:00
|
|
|
|
|
|
|
ui = callPackage ./ui.nix { };
|
|
|
|
|
|
|
|
preBuild = ''
|
2023-09-06 10:11:16 +00:00
|
|
|
if [ -n "$ui" ] # to make the preBuild a no-op inside the goModules fixed-output derivation, where it would fail
|
|
|
|
then
|
2023-09-09 16:09:11 +00:00
|
|
|
cp -r $ui ui/build
|
2023-09-06 10:11:16 +00:00
|
|
|
fi
|
2019-10-05 07:46:51 +00:00
|
|
|
'';
|
|
|
|
|
2020-05-10 20:12:41 +00:00
|
|
|
passthru = {
|
2023-09-06 10:11:16 +00:00
|
|
|
# For nix-update to detect the location of this attribute from this
|
|
|
|
# derivation.
|
|
|
|
inherit (ui) offlineCache;
|
|
|
|
updateScript = nix-update-script { };
|
2023-09-06 03:07:18 +00:00
|
|
|
tests = {
|
|
|
|
nixos = nixosTests.gotify-server;
|
|
|
|
};
|
2020-05-10 20:12:41 +00:00
|
|
|
};
|
|
|
|
|
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 = [ "." ];
|
|
|
|
|
2021-08-26 03:31:57 +00:00
|
|
|
ldflags = [
|
|
|
|
"-X main.Version=${version}" "-X main.Mode=prod"
|
2019-10-05 07:46:51 +00:00
|
|
|
];
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-10-05 07:46:51 +00:00
|
|
|
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 ];
|
2022-05-05 00:46:39 +00:00
|
|
|
mainProgram = "server";
|
2019-10-05 07:46:51 +00:00
|
|
|
};
|
|
|
|
}
|