This repository has been archived on 2024-10-13. You can view files and clone it, but cannot push or open issues or pull requests.
nix-packages/matrix/mautrix-whatsapp/default.nix

43 lines
1.5 KiB
Nix
Raw Normal View History

2022-06-12 14:28:17 +00:00
{
2023-04-21 13:51:47 +00:00
buildGoApplication,
2022-09-25 19:17:36 +00:00
olm,
fetchFromGitHub,
lib,
writeScript,
2022-10-12 15:04:19 +00:00
go,
2022-09-25 19:17:36 +00:00
}: let
source = builtins.fromJSON (builtins.readFile ./source.json);
in
2023-04-21 13:51:47 +00:00
buildGoApplication rec {
2022-06-12 14:28:17 +00:00
pname = "mautrix-whatsapp";
2022-09-25 19:17:36 +00:00
version = source.date;
src = fetchFromGitHub {
owner = "mautrix";
repo = "whatsapp";
inherit (source) rev sha256;
};
2023-04-21 13:51:47 +00:00
modules = ./gomod2nix.toml;
2022-09-25 19:17:36 +00:00
buildInputs = [
olm
];
2022-06-12 14:28:17 +00:00
CGO_ENABLED = "1";
2022-09-25 19:17:36 +00:00
meta = {
description = "Whatsapp-Matrix double-puppeting bridge";
license = lib.licenses.agpl3;
2022-10-09 16:07:29 +00:00
broken = builtins.compareVersions go.version "1.18" < 0;
2022-09-25 19:17:36 +00:00
};
2023-08-22 12:10:26 +00:00
postConfigure = ''
chmod -R +w vendor/
for f in $(find vendor/github.com/chai2010/webp/internal/ -type l) vendor/go.mau.fi/util/variationselector/*.json vendor/golang.org/x/net/publicsuffix/data/* vendor/maunium.net/go/mautrix/crypto/sql_store_upgrade/*.sql vendor/maunium.net/go/mautrix/sqlstatestore/*.sql vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.raw; do
cp -v --remove-destination -f `readlink $f` $f
done
'';
2022-09-25 19:17:36 +00:00
passthru.updateScript = writeScript "update-mautrix-whatsapp" ''
${../../scripts/update-git.sh} "https://github.com/mautrix/whatsapp" matrix/mautrix-whatsapp/source.json
if [ "$(git diff -- matrix/mautrix-whatsapp/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-whatsapp/
fi
2022-09-25 19:17:36 +00:00
'';
}