2022-07-20 08:36:55 +00:00
|
|
|
{
|
2023-04-21 13:51:47 +00:00
|
|
|
buildGoApplication,
|
2022-09-25 19:06:33 +00:00
|
|
|
olm,
|
|
|
|
fetchFromGitHub,
|
|
|
|
lib,
|
|
|
|
writeScript,
|
2022-11-04 17:10:13 +00:00
|
|
|
go,
|
2022-09-25 19:06:33 +00:00
|
|
|
}: let
|
|
|
|
source = builtins.fromJSON (builtins.readFile ./source.json);
|
|
|
|
in
|
2023-04-21 13:51:47 +00:00
|
|
|
buildGoApplication rec {
|
2022-07-20 08:36:55 +00:00
|
|
|
pname = "mautrix-discord";
|
2022-09-25 19:06:33 +00:00
|
|
|
version = source.date;
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mautrix";
|
|
|
|
repo = "discord";
|
|
|
|
inherit (source) rev sha256;
|
|
|
|
};
|
2023-04-21 13:51:47 +00:00
|
|
|
modules = ./gomod2nix.toml;
|
2022-09-25 19:06:33 +00:00
|
|
|
buildInputs = [
|
|
|
|
olm
|
|
|
|
];
|
2022-07-20 08:36:55 +00:00
|
|
|
CGO_ENABLED = "1";
|
2022-09-25 19:06:33 +00:00
|
|
|
meta = {
|
|
|
|
description = "Discord-Matrix double-puppeting bridge";
|
|
|
|
license = lib.licenses.agpl3;
|
2022-11-04 15:34:43 +00:00
|
|
|
broken = builtins.compareVersions go.version "1.18" < 0;
|
2022-09-25 19:06:33 +00:00
|
|
|
};
|
|
|
|
passthru.updateScript = writeScript "update-matrix-media-repo" ''
|
|
|
|
${../../scripts/update-git.sh} "https://github.com/mautrix/discord" matrix/mautrix-discord/source.json
|
2022-11-21 09:55:15 +00:00
|
|
|
if [ "$(git diff -- matrix/mautrix-discord/source.json)" ]; then
|
|
|
|
SRC_PATH=$(nix-build -E '(import ./. {}).${pname}.src')
|
2023-04-21 13:51:47 +00:00
|
|
|
${../../scripts/update-go.sh} $SRC_PATH matrix/mautrix-discord/
|
2022-11-21 09:55:15 +00:00
|
|
|
fi
|
2022-09-25 19:06:33 +00:00
|
|
|
'';
|
|
|
|
}
|