mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-25 17:46:14 +01:00
Bump mautrix-signal
Signed-off-by: magic_rb <magic_rb@redalder.org>
This commit is contained in:
parent
67df3e94fb
commit
39e63f2e09
|
@ -16,22 +16,103 @@
|
||||||
init.services.mautrix-signal = {
|
init.services.mautrix-signal = {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
shutdownOnExit = true;
|
shutdownOnExit = true;
|
||||||
script = pkgs.writeShellScript "mautrix-signal" ''
|
script = let
|
||||||
DATA_DIR="/var/lib/mautrix-signal"
|
nixpkgsSignal = pkgs.fetchFromGitHub {
|
||||||
CONFIG_FILE="$DATA_DIR/config.yaml"
|
owner = "NixOS";
|
||||||
REGISTRATION_FILE="/var/lib/registrations/mautrix-signal.yaml"
|
repo = "nixpkgs";
|
||||||
DB_FILE="$DATA_DIR/sqlite.db"
|
rev = "cf886946e2917dc1b1e7836e129bedce778cf347";
|
||||||
|
hash = "sha256-dUaQCYgKc4TNFY7HXyFQEvA5jM2ckvV9Pf8/jZqRGTA=";
|
||||||
|
};
|
||||||
|
boringssl-wrapper = pkgs.runCommand "boringssl-wrapper" {} ''
|
||||||
|
mkdir $out
|
||||||
|
cd $out
|
||||||
|
ln -s ${pkgs.boringssl.out}/lib build
|
||||||
|
ln -s ${pkgs.boringssl.dev}/include include
|
||||||
|
'';
|
||||||
|
libsignal-ffi = pkgs.rustPlatform.buildRustPackage rec {
|
||||||
|
pname = "libsignal-ffi";
|
||||||
|
# must match the version used in mautrix-signal
|
||||||
|
# see https://github.com/mautrix/signal/issues/401
|
||||||
|
version = "0.41.0";
|
||||||
|
|
||||||
cp ${./mautrix-signal.yaml} "$CONFIG_FILE" ; chmod 755 "$CONFIG_FILE"
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "signalapp";
|
||||||
|
repo = "libsignal";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-U/Wy7nzRQJLdc/dGmYR418Nt1KV70HbcgnDHmYxKytg=";
|
||||||
|
};
|
||||||
|
|
||||||
[ -e "$REGISTRATION_FILE" ] || \
|
nativeBuildInputs = [pkgs.protobuf] ++ lib.optionals pkgs.stdenv.isDarwin [pkgs.xcodebuild];
|
||||||
${lib.getExe' pkgs.mautrix-signal "mautrix-signal"} -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -g
|
buildInputs = [pkgs.rustPlatform.bindgenHook];
|
||||||
sed -i \
|
|
||||||
-e 's/@AS_TOKEN@/'"$(${lib.getExe pkgs.yq} -r '.as_token' "$REGISTRATION_FILE")/" \
|
env.BORING_BSSL_PATH = "${boringssl-wrapper}";
|
||||||
-e 's/@HS_TOKEN@/'"$(${lib.getExe pkgs.yq} -r '.hs_token' "$REGISTRATION_FILE")/" \
|
|
||||||
"$CONFIG_FILE"
|
# The Cargo.lock contains git dependencies
|
||||||
${lib.getExe' pkgs.mautrix-signal "mautrix-signal"} -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -n
|
cargoLock = {
|
||||||
'';
|
lockFile = "${nixpkgsSignal}/pkgs/by-name/li/libsignal-ffi/Cargo.lock";
|
||||||
|
outputHashes = {
|
||||||
|
"boring-3.1.0" = "sha256-R6hh4K57mgV10nuVcMZETvxlQsMsmGapgCQ7pjuognk=";
|
||||||
|
"curve25519-dalek-4.1.1" = "sha256-p9Vx0lAaYILypsI4/RVsHZLOqZKaa4Wvf7DanLA38pc=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoBuildFlags = ["-p" "libsignal-ffi"];
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "A C ABI library which exposes Signal protocol logic";
|
||||||
|
homepage = "https://github.com/signalapp/libsignal";
|
||||||
|
license = licenses.agpl3Plus;
|
||||||
|
maintainers = with maintainers; [niklaskorz];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
mautrix-signal = pkgs.buildGoModule rec {
|
||||||
|
pname = "mautrix-signal";
|
||||||
|
version = "0.5.1";
|
||||||
|
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "mautrix";
|
||||||
|
repo = "signal";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-juem0enwwY5HOgci9Am2xcAsJK0F48DtpU7J/Osqd9k=";
|
||||||
|
};
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
pkgs.olm
|
||||||
|
# must match the version used in https://github.com/mautrix/signal/tree/main/pkg/libsignalgo
|
||||||
|
# see https://github.com/mautrix/signal/issues/401
|
||||||
|
libsignal-ffi
|
||||||
|
];
|
||||||
|
|
||||||
|
vendorHash = "sha256-CnuRzDiUVJt4PrU8u7UmT1ejrdpsohmDv8M0qfFb0Ac=";
|
||||||
|
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
homepage = "https://github.com/mautrix/signal";
|
||||||
|
description = "A Matrix-Signal puppeting bridge";
|
||||||
|
license = licenses.agpl3Plus;
|
||||||
|
maintainers = with maintainers; [expipiplus1 niklaskorz ma27];
|
||||||
|
mainProgram = "mautrix-signal";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
pkgs.writeShellScript "mautrix-signal" ''
|
||||||
|
DATA_DIR="/var/lib/mautrix-signal"
|
||||||
|
CONFIG_FILE="$DATA_DIR/config.yaml"
|
||||||
|
REGISTRATION_FILE="/var/lib/registrations/mautrix-signal.yaml"
|
||||||
|
DB_FILE="$DATA_DIR/sqlite.db"
|
||||||
|
|
||||||
|
cp ${./mautrix-signal.yaml} "$CONFIG_FILE" ; chmod 755 "$CONFIG_FILE"
|
||||||
|
|
||||||
|
[ -e "$REGISTRATION_FILE" ] || \
|
||||||
|
${lib.getExe' mautrix-signal "mautrix-signal"} -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -g
|
||||||
|
sed -i \
|
||||||
|
-e 's/@AS_TOKEN@/'"$(${lib.getExe pkgs.yq} -r '.as_token' "$REGISTRATION_FILE")/" \
|
||||||
|
-e 's/@HS_TOKEN@/'"$(${lib.getExe pkgs.yq} -r '.hs_token' "$REGISTRATION_FILE")/" \
|
||||||
|
"$CONFIG_FILE"
|
||||||
|
${lib.getExe' mautrix-signal "mautrix-signal"} -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -n
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue