add mautrix-whatsapp
This commit is contained in:
parent
34c1b687e2
commit
31ef34e5fe
7 changed files with 42 additions and 160 deletions
|
@ -32,4 +32,5 @@
|
|||
nasin-nanpa = pkgs.callPackage ./fonts/nasin-nanpa {};
|
||||
matrix-media-repo = pkgs.callPackage ./matrix/matrix-media-repo {};
|
||||
mautrix-discord = pkgs.callPackage ./matrix/mautrix-discord {};
|
||||
mautrix-whatsapp = pkgs.callPackage ./matrix/mautrix-whatsapp {};
|
||||
}
|
||||
|
|
|
@ -1,17 +1,33 @@
|
|||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
} @ args: let
|
||||
inherit ((pkgs.callPackage "${inputs.gomod2nix}/builder" {})) buildGoApplication;
|
||||
in {
|
||||
mautrix-whatsapp = buildGoApplication rec {
|
||||
buildGoModule,
|
||||
olm,
|
||||
fetchFromGitHub,
|
||||
lib,
|
||||
writeScript,
|
||||
}: let
|
||||
source = builtins.fromJSON (builtins.readFile ./source.json);
|
||||
in
|
||||
buildGoModule rec {
|
||||
pname = "mautrix-whatsapp";
|
||||
version = inputs.mautrix-whatsapp.lastModifiedDate;
|
||||
src = pkgs.callPackage ./source.nix {};
|
||||
version = source.date;
|
||||
src = fetchFromGitHub {
|
||||
owner = "mautrix";
|
||||
repo = "whatsapp";
|
||||
inherit (source) rev sha256;
|
||||
};
|
||||
vendorSha256 = builtins.readFile ./vendor.sha256;
|
||||
buildInputs = [
|
||||
olm
|
||||
];
|
||||
proxyVendor = true;
|
||||
modules = ./gomod2nix.toml;
|
||||
CGO_ENABLED = "1";
|
||||
buildInputs = [pkgs.olm];
|
||||
};
|
||||
}
|
||||
meta = {
|
||||
description = "Whatsapp-Matrix double-puppeting bridge";
|
||||
license = lib.licenses.agpl3;
|
||||
};
|
||||
passthru.updateScript = writeScript "update-mautrix-whatsapp" ''
|
||||
${../../scripts/update-git.sh} "https://github.com/mautrix/whatsapp" matrix/mautrix-whatsapp/source.json
|
||||
SRC_PATH=$(nix-build -E '(import ./. {}).${pname}.src')
|
||||
${../../scripts/update-go.sh} ./matrix/mautrix-whatsapp matrix/mautrix-whatsapp/vendor.sha256
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
schema = 3
|
||||
|
||||
[mod]
|
||||
[mod."filippo.io/edwards25519"]
|
||||
version = "v1.0.0"
|
||||
hash = "sha256-APnPAcmItvtJ5Zsy863lzR2TjEBF9Y66TY1e4M1ap98="
|
||||
[mod."github.com/beorn7/perks"]
|
||||
version = "v1.0.1"
|
||||
hash = "sha256-h75GUqfwJKngCJQVE5Ao5wnO3cfKD9lSIteoLp/3xJ4="
|
||||
[mod."github.com/cespare/xxhash/v2"]
|
||||
version = "v2.1.2"
|
||||
hash = "sha256-YV9SmXDtmmgQylQUfrUgQLAPfqYexcHxegMBT+IX9qM="
|
||||
[mod."github.com/chai2010/webp"]
|
||||
version = "v1.1.1"
|
||||
hash = "sha256-fgqfaEmrjMRcUC6WXVISIujzGYauZTKDDrJGLodn70c="
|
||||
[mod."github.com/golang/protobuf"]
|
||||
version = "v1.5.2"
|
||||
hash = "sha256-IVwooaIo46iq7euSSVWTBAdKd+2DUaJ67MtBao1DpBI="
|
||||
[mod."github.com/gorilla/mux"]
|
||||
version = "v1.8.0"
|
||||
hash = "sha256-s905hpzMH9bOLue09E2JmzPXfIS4HhAlgT7g13HCwKE="
|
||||
[mod."github.com/gorilla/websocket"]
|
||||
version = "v1.5.0"
|
||||
hash = "sha256-EYVgkSEMo4HaVrsWKqnsYRp8SSS8gNf7t+Elva02Ofc="
|
||||
[mod."github.com/lib/pq"]
|
||||
version = "v1.10.6"
|
||||
hash = "sha256-8EhFwY/9YH5L/fd6l2beOnC3VvpegRAmCCsnDVJBqBM="
|
||||
[mod."github.com/mattn/go-colorable"]
|
||||
version = "v0.1.12"
|
||||
hash = "sha256-Y1vCt0ShrCz4wSmwsppCfeLPLKrWusc2zM2lUFwDMyI="
|
||||
[mod."github.com/mattn/go-isatty"]
|
||||
version = "v0.0.14"
|
||||
hash = "sha256-e8zn5eCVh/B1HOP1PGXeXH0bGkIV0vKYP9KLwZni5as="
|
||||
[mod."github.com/mattn/go-sqlite3"]
|
||||
version = "v1.14.15"
|
||||
hash = "sha256-fSrs2sdBKFTAiffBHNnAkN8kDTqiXgm4HNqzJAOF1RM="
|
||||
[mod."github.com/matttproud/golang_protobuf_extensions"]
|
||||
version = "v1.0.1"
|
||||
hash = "sha256-ystDNStxR90j4CK+AMcEQ5oyYFRgWoGdvWlS0XQMDLQ="
|
||||
[mod."github.com/prometheus/client_golang"]
|
||||
version = "v1.13.0"
|
||||
hash = "sha256-5nC5FuGuAB71k6Dm4vBcmpPpBAKfvArO/yr7e9rfQfg="
|
||||
[mod."github.com/prometheus/client_model"]
|
||||
version = "v0.2.0"
|
||||
hash = "sha256-LTHxYPRgoggl+v89ly2/RkyPIuJlmZRdGs6ZRtK3zkk="
|
||||
[mod."github.com/prometheus/common"]
|
||||
version = "v0.37.0"
|
||||
hash = "sha256-B2v0WsP8uKWYBpZcrog/sQXStIXwWZcVLmfPgnh1ZZA="
|
||||
[mod."github.com/prometheus/procfs"]
|
||||
version = "v0.8.0"
|
||||
hash = "sha256-hgrilokQsXCOCCvwgOSfuErxoFAQpXM/+zNJKcMVHyM="
|
||||
[mod."github.com/rs/zerolog"]
|
||||
version = "v1.27.0"
|
||||
hash = "sha256-BxQtP2TROeSSpj9l1irocuSfxn55UL4ugzB/og7r8eE="
|
||||
[mod."github.com/skip2/go-qrcode"]
|
||||
version = "v0.0.0-20200617195104-da1b6568686e"
|
||||
hash = "sha256-ST9t4/b7WFXUb8wra4ZYVDNZJGrEykw8dkWhLrxp8F0="
|
||||
[mod."github.com/tidwall/gjson"]
|
||||
version = "v1.14.3"
|
||||
hash = "sha256-CjsKkesYwKl6hwHXB/+mvkuzW2ihKecUyvUFHUtylcw="
|
||||
[mod."github.com/tidwall/match"]
|
||||
version = "v1.1.1"
|
||||
hash = "sha256-M2klhPId3Q3T3VGkSbOkYl/2nLHnsG+yMbXkPkyrRdg="
|
||||
[mod."github.com/tidwall/pretty"]
|
||||
version = "v1.2.0"
|
||||
hash = "sha256-esRQGsn2Ee/CiySlwyuOICSLdqUkH4P7u8qXszos8Yc="
|
||||
[mod."github.com/tidwall/sjson"]
|
||||
version = "v1.2.5"
|
||||
hash = "sha256-OYGNolkmL7E1Qs2qrQ3IVpQp5gkcHNU/AB/z2O+Myps="
|
||||
[mod."github.com/yuin/goldmark"]
|
||||
version = "v1.4.13"
|
||||
hash = "sha256-GVwFKZY6moIS6I0ZGuio/WtDif+lkZRfqWS6b4AAJyI="
|
||||
[mod."go.mau.fi/libsignal"]
|
||||
version = "v0.0.0-20220628090436-4d18b66b087e"
|
||||
hash = "sha256-H601DPysjRRWn12zM1NRozGCkLkWriR/VviVPfpd5vY="
|
||||
[mod."go.mau.fi/whatsmeow"]
|
||||
version = "v0.0.0-20220912085258-5c8577b8ac6f"
|
||||
hash = "sha256-HMNqQ+9AtW8gAZIx1dWEBTbj8PiyyzVG4qTw+X/4zFc="
|
||||
[mod."golang.org/x/crypto"]
|
||||
version = "v0.0.0-20220817201139-bc19a97f63c8"
|
||||
hash = "sha256-LvSArox3yRkhJLOik9DLTSBp4ldI+OHjiWWilg2t4Hs="
|
||||
[mod."golang.org/x/image"]
|
||||
version = "v0.0.0-20220722155232-062f8c9fd539"
|
||||
hash = "sha256-Rl3kKCUy5h1CqLsA87vyg3fSb05qKjd3tI6QvC1LfkI="
|
||||
[mod."golang.org/x/net"]
|
||||
version = "v0.0.0-20220812174116-3211cb980234"
|
||||
hash = "sha256-v/Qep/W6lw6IurR+R2V0AN/MlQUROLnEaWeeuwY8sg8="
|
||||
[mod."golang.org/x/sys"]
|
||||
version = "v0.0.0-20220728004956-3c1f35247d10"
|
||||
hash = "sha256-obSKM1aiGEyYNauzaL0msReglT2XL726gL89ywjFLE8="
|
||||
[mod."golang.org/x/text"]
|
||||
version = "v0.3.7"
|
||||
hash = "sha256-XH2pUzzQx95O0rak00grQvfACfL+EmZiV7ZzJBkX+XY="
|
||||
[mod."google.golang.org/protobuf"]
|
||||
version = "v1.28.1"
|
||||
hash = "sha256-sTJYgvlv5is7vHNxcuigF2lNASp0QonhUgnrguhfHSU="
|
||||
[mod."gopkg.in/yaml.v3"]
|
||||
version = "v3.0.1"
|
||||
hash = "sha256-FqL9TKYJ0XkNwJFnq9j0VvJ5ZUU1RvH/52h/f5bkYAU="
|
||||
[mod."maunium.net/go/mauflag"]
|
||||
version = "v1.0.0"
|
||||
hash = "sha256-fYc/WwqE0ev0dvnu5qGmHJsYiSTuWeOTiAVzmQIKWyY="
|
||||
[mod."maunium.net/go/maulogger/v2"]
|
||||
version = "v2.3.2"
|
||||
hash = "sha256-FlrO1bogPrIzzVzDtIovYyr+1mNk0YaO5hEVv5zovM8="
|
||||
[mod."maunium.net/go/mautrix"]
|
||||
version = "v0.12.1"
|
||||
hash = "sha256-nYa2Nt+Wx44ieRbJuaaI4FvyDp0PBZOg8N/XtDy4jPo="
|
11
matrix/mautrix-whatsapp/source.json
Normal file
11
matrix/mautrix-whatsapp/source.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"url": "https://github.com/mautrix/whatsapp",
|
||||
"rev": "f0401ee81e2e71262498d4e34e25c141b5b92acd",
|
||||
"date": "2022-09-20T17:31:12+03:00",
|
||||
"path": "/nix/store/m2mw41bvpjmjcgnfaygdsz6ff0if85qj-whatsapp",
|
||||
"sha256": "05yxf7c9xdlhp8d4rj4m9qfhfdqp7nqxzf10l8mxa5apbgww2hbq",
|
||||
"fetchLFS": false,
|
||||
"fetchSubmodules": false,
|
||||
"deepClone": false,
|
||||
"leaveDotGit": false
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{fetchgit}:
|
||||
fetchgit {
|
||||
url = "https://github.com/mautrix/whatsapp";
|
||||
rev = "f0401ee81e2e71262498d4e34e25c141b5b92acd";
|
||||
sha256 = "0k9qhfd6h3br1l6yqm1ps7gvrfz84xxdw6x8y3h9wvbmc3ym2g6y";
|
||||
leaveDotGit = true;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p nix-prefetch-git jq
|
||||
set -e
|
||||
|
||||
WORK_DIR=$(mktemp -d)
|
||||
URL=https://github.com/mautrix/whatsapp
|
||||
REVISION=$(jq -r '.nodes."mautrix-whatsapp".locked.rev' ../../flake.lock)
|
||||
TARGET_DIR="$PWD"
|
||||
|
||||
function cleanup {
|
||||
grep "fatal" $WORK_DIR/nix-prefetch-git.out >/dev/stderr || true
|
||||
rm -rf "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
echo "Fetching source code $REVISION from $URL"
|
||||
JSON=$(nix-prefetch-git --url "$URL" --rev "$REVISION" --leave-dotGit 2> $WORK_DIR/nix-prefetch-git.out)
|
||||
SHA=$(echo $JSON | jq -r .sha256)
|
||||
SOURCE_DIR=$(grep '^path is' $WORK_DIR/nix-prefetch-git.out | sed 's/^path is //')
|
||||
|
||||
cat > source.nix << EOF
|
||||
{fetchgit}:
|
||||
fetchgit {
|
||||
url = "$URL";
|
||||
rev = "$REVISION";
|
||||
sha256 = "$SHA";
|
||||
leaveDotGit = true;
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "Creating gomod2nix.toml"
|
||||
nix run github:tweag/gomod2nix -- --dir $SOURCE_DIR --outdir $TARGET_DIR
|
1
matrix/mautrix-whatsapp/vendor.sha256
Normal file
1
matrix/mautrix-whatsapp/vendor.sha256
Normal file
|
@ -0,0 +1 @@
|
|||
sha256-GR4VTGUzB76/V+ZwMELQpW0r/EEkUpfnpp/Izp0P6hE=
|
Reference in a new issue