2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, buildGoModule
|
|
|
|
, sqlite
|
|
|
|
, callPackage
|
2023-10-09 19:29:22 +00:00
|
|
|
, nixosTests
|
|
|
|
, nix-update-script
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "gotify-server";
|
2024-06-24 18:47:55 +00:00
|
|
|
version = "2.5.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gotify";
|
|
|
|
repo = "server";
|
|
|
|
rev = "v${version}";
|
2024-06-24 18:47:55 +00:00
|
|
|
hash = "sha256-Na/bxETIgVm1mxMOXWTgYIFFuB6XG1jGvbW6q/n5LRw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-12-03 08:41:04 +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;
|
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
vendorHash = "sha256-Vnk/c2dzxIXDChobFSP++9uyiFD+SKyxJC9ZwaQ2pVw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
buildInputs = [
|
|
|
|
sqlite
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
ui = callPackage ./ui.nix { };
|
|
|
|
|
|
|
|
preBuild = ''
|
2023-10-09 19:29:22 +00:00
|
|
|
if [ -n "$ui" ] # to make the preBuild a no-op inside the goModules fixed-output derivation, where it would fail
|
|
|
|
then
|
|
|
|
cp -r $ui ui/build
|
|
|
|
fi
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
passthru = {
|
2023-10-09 19:29:22 +00:00
|
|
|
# For nix-update to detect the location of this attribute from this
|
|
|
|
# derivation.
|
|
|
|
inherit (ui) offlineCache;
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
tests = {
|
|
|
|
nixos = nixosTests.gotify-server;
|
|
|
|
};
|
2020-05-15 21:57:56 +00:00
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +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-27 14:25:00 +00:00
|
|
|
ldflags = [
|
|
|
|
"-X main.Version=${version}" "-X main.Mode=prod"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Simple server for sending and receiving messages in real-time per WebSocket";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://gotify.net";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ doronbehar ];
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "server";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|