nixpkgs/pkgs/servers/gotify/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
1.7 KiB
Nix
Raw Normal View History

{ lib
2019-10-05 07:46:51 +00:00
, 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";
version = "2.4.0";
2019-10-05 07:46:51 +00:00
src = fetchFromGitHub {
owner = "gotify";
repo = "server";
rev = "v${version}";
hash = "sha256-TZeQcrJCH9TW039r499fxY4xJ27nZm9GdrilsI33Iqc=";
2019-10-05 07:46:51 +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;
vendorHash = "sha256-TR6YGNhSMQ/1kvX3p3QGlXovuoJdaRH0LOwIPZwQ/xY=";
2019-10-05 07:46:51 +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
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
];
meta = with lib; {
description = "Simple server for sending and receiving messages in real-time per WebSocket";
2019-10-05 07:46:51 +00:00
homepage = "https://gotify.net";
license = licenses.mit;
maintainers = with maintainers; [ doronbehar ];
mainProgram = "server";
2019-10-05 07:46:51 +00:00
};
}