2022-01-12 05:45:44 +00:00
|
|
|
{ stdenv, lib, fetchurl, makeWrapper, openjdk17_headless, libmatthew_java, dbus, dbus_java }:
|
2019-01-21 03:15:18 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "signal-cli";
|
2022-01-23 16:42:24 +00:00
|
|
|
version = "0.10.2";
|
2019-01-21 03:15:18 +00:00
|
|
|
|
|
|
|
# Building from source would be preferred, but is much more involved.
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/AsamK/signal-cli/releases/download/v${version}/signal-cli-${version}.tar.gz";
|
2022-01-23 16:42:24 +00:00
|
|
|
sha256 = "sha256-etCO7sy48A7aL3mnXWitClNiw/E122G4eD6YfVmXEPw=";
|
2019-01-21 03:15:18 +00:00
|
|
|
};
|
|
|
|
|
2019-11-24 16:14:28 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isLinux [ libmatthew_java dbus dbus_java ];
|
2019-11-04 20:16:45 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2019-01-21 03:15:18 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp -r lib $out/lib
|
|
|
|
cp bin/signal-cli $out/bin/signal-cli
|
2019-11-04 20:16:45 +00:00
|
|
|
'' + (if stdenv.isLinux then ''
|
2022-01-12 05:45:44 +00:00
|
|
|
makeWrapper ${openjdk17_headless}/bin/java $out/bin/signal-cli \
|
|
|
|
--set JAVA_HOME "${openjdk17_headless}" \
|
2019-11-04 20:16:45 +00:00
|
|
|
--add-flags "-classpath '$out/lib/*:${libmatthew_java}/lib/jni'" \
|
|
|
|
--add-flags "-Djava.library.path=${libmatthew_java}/lib/jni:${dbus_java}/share/java/dbus:$out/lib" \
|
|
|
|
--add-flags "org.asamk.signal.Main"
|
|
|
|
'' else ''
|
2019-01-21 03:15:18 +00:00
|
|
|
wrapProgram $out/bin/signal-cli \
|
2022-01-12 05:45:44 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ openjdk17_headless ]} \
|
|
|
|
--set JAVA_HOME ${openjdk17_headless}
|
2019-11-04 20:16:45 +00:00
|
|
|
'');
|
2019-01-21 03:15:18 +00:00
|
|
|
|
|
|
|
# Execution in the macOS (10.13) sandbox fails with
|
|
|
|
# dyld: Library not loaded: /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa
|
|
|
|
# Referenced from: /nix/store/5ghc2l65p8jcjh0bsmhahd5m9k5p8kx0-zulu1.8.0_121-8.20.0.5/bin/java
|
|
|
|
# Reason: no suitable image found. Did find:
|
|
|
|
# /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa: file system sandbox blocked stat()
|
|
|
|
# /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa: file system sandbox blocked stat()
|
|
|
|
# /nix/store/in41dz8byyyz4c0w132l7mqi43liv4yr-stdenv-darwin/setup: line 1310: 2231 Abort trap: 6 signal-cli --version
|
|
|
|
doInstallCheck = stdenv.isLinux;
|
2019-11-04 20:16:45 +00:00
|
|
|
|
2019-01-21 03:15:18 +00:00
|
|
|
installCheckPhase = ''
|
|
|
|
export PATH=$PATH:$out/bin
|
|
|
|
# --help returns non-0 exit code even when working
|
|
|
|
signal-cli --version
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2020-04-01 20:22:05 +01:00
|
|
|
homepage = "https://github.com/AsamK/signal-cli";
|
2019-01-21 03:15:18 +00:00
|
|
|
description = "Command-line and dbus interface for communicating with the Signal messaging service";
|
|
|
|
license = licenses.gpl3;
|
2019-11-05 13:48:09 +00:00
|
|
|
maintainers = with maintainers; [ ivan erictapen ];
|
2019-01-21 03:15:18 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|