commit 9cd66b692ec633fc057bf4d4e45e7d0e4d78271a
parent 1a9bcca3931a8f93a759dfdcaf6499ef18a7353c
Author: Katja (ctucx) <git@ctu.cx>
Date: Thu, 20 Mar 2025 15:14:49 +0100
parent 1a9bcca3931a8f93a759dfdcaf6499ef18a7353c
Author: Katja (ctucx) <git@ctu.cx>
Date: Thu, 20 Mar 2025 15:14:49 +0100
packages/all: add `mautrix-telegramgo`
1 file changed, 47 insertions(+), 0 deletions(-)
diff --git a/packages/all/mautrix-telegramgo.nix b/packages/all/mautrix-telegramgo.nix @@ -0,0 +1,47 @@ +{ + lib, + stdenv, + buildGoModule, + fetchFromGitHub, + olm, + versionCheckHook, + # This option enables the use of an experimental pure-Go implementation of + # the Olm protocol instead of libolm for end-to-end encryption. Using goolm + # is not recommended by the mautrix developers, but they are interested in + # people trying it out in non-production-critical environments and reporting + # any issues they run into. + withGoolm ? true, +}: + +let + cppStdLib = if stdenv.hostPlatform.isDarwin then "-lc++" else "-lstdc++"; + +in buildGoModule rec { + pname = "mautrix-telegramgo"; + rev = "09b1e69c0fa0d915290411274861aee04191cab6"; + version = "0.0.0-${builtins.substring 0 6 rev}"; + + src = fetchFromGitHub { + owner = "mautrix"; + repo = "telegramgo"; + hash = "sha256-HNwtmV1Op7zO+BJzij12CitOciqrZETbz+AbrcaMyD4="; + inherit rev; + }; + + buildInputs = (lib.optional (!withGoolm) olm) ++ (lib.optional withGoolm stdenv.cc.cc.lib); + + CGO_LDFLAGS = lib.optional withGoolm [ cppStdLib ]; + + tags = lib.optional withGoolm "goolm"; + + doCheck = false; + + vendorHash = "sha256-oIkeNnABb9GZfeLrvkVEWcJ6iutC2uS217EkGhEAFcs="; + + meta = with lib; { + homepage = "https://github.com/mautrix/telegramgo"; + description = "Go rewrite of mautrix-telegram"; + license = licenses.agpl3Plus; + mainProgram = "mautrix-telegram"; + }; +}