Files
nix-packaging/threema-desktop.nix

77 lines
1.6 KiB
Nix

{
lib,
buildNpmPackage,
fetchFromGitHub,
rustPlatform,
binaryen,
pkg-config,
openssl,
wasm-bindgen-cli,
protobuf,
lld,
}:
buildNpmPackage rec {
pname = "threema-desktop";
version = "2.0-beta56";
src = fetchFromGitHub {
owner = "threema-ch";
repo = "threema-desktop";
rev = "v${version}";
hash = "sha256-wMIQ7piFPOBp0IleSnDSrZjaqXNBDyeELjx+938pmVk=";
};
forceGitDeps = true;
npmDepsHash = "sha256-9pyBbA+MARxWPZzyvjyKCuofgt+X3DrDCa81S6/S5qg="; # replace after first build
npmFlags = [ "--legacy-peer-deps" ];
makeCacheWritable = true;
cargoDeps = rustPlatform.fetchCargoVendor {
inherit src;
sourceRoot = "${src.name}/libs/libthreema";
hash = "sha256-SQ33LcCYlJ3W69TmpH1AkOKaREZ0p3KotJPuKZtc6yI=";
};
nativeBuildInputs = [
rustPlatform.bindgenHook
wasm-bindgen-cli
binaryen
pkg-config
protobuf
lld
];
buildInputs = [
openssl
];
postPatch = ''
patchShebangs --build ./tools
patchShebangs --build ./libs/libthreema/tools
sed -i '/"engines":/,/},/d' package.json
'';
buildPhase = ''
runHook preBuild
npm run libthreema:build
npm run package binary consumer-live
runHook postBuild
'';
installPhase = ''
mkdir -p $out/opt/threema-desktop
cp -r build/out/* $out/opt/threema-desktop
'';
meta = with lib; {
description = "Threema App for Desktop (Windows/macOS/Linux)";
longDescription = "A standalone Threema client for the desktop with end-to-end encryption";
homepage = "https://threema.ch/";
license = licenses.agpl3Plus;
maintainers = [ ];
platforms = platforms.linux;
};
}