2020-03-26 10:30:37 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
|
|
|
, autoPatchelfHook
|
2021-11-15 19:26:14 +00:00
|
|
|
, fuse, jffi
|
2020-03-26 10:30:37 +00:00
|
|
|
, maven, jdk, jre, makeWrapper, glib, wrapGAppsHook
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "cryptomator";
|
2022-03-26 07:48:16 +00:00
|
|
|
version = "1.6.7";
|
2020-03-26 10:30:37 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "cryptomator";
|
|
|
|
repo = "cryptomator";
|
|
|
|
rev = version;
|
2022-03-26 07:48:16 +00:00
|
|
|
sha256 = "sha256-hOILOdVYBnS9XuEXaIJcf2bPF72Lcr7IBX4CFCIsC8k=";
|
2020-03-26 10:30:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# perform fake build to make a fixed-output derivation out of the files downloaded from maven central (120MB)
|
|
|
|
deps = stdenv.mkDerivation {
|
|
|
|
name = "cryptomator-${version}-deps";
|
|
|
|
inherit src;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ jdk maven ];
|
2021-11-15 19:26:14 +00:00
|
|
|
buildInputs = [ jre ];
|
2020-03-26 10:30:37 +00:00
|
|
|
|
|
|
|
buildPhase = ''
|
2022-03-26 07:48:16 +00:00
|
|
|
while mvn -Plinux package -Dmaven.test.skip=true -Dmaven.repo.local=$out/.m2 -Dmaven.wagon.rto=5000; [ $? = 1 ]; do
|
2020-03-26 10:30:37 +00:00
|
|
|
echo "timeout, restart maven to continue downloading"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
# keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
|
|
|
|
installPhase = ''
|
|
|
|
find $out/.m2 -type f -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' -delete
|
|
|
|
find $out/.m2 -type f -iname '*.pom' -exec sed -i -e 's/\r\+$//' {} \;
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
outputHashMode = "recursive";
|
2022-03-26 07:48:16 +00:00
|
|
|
outputHash = "sha256-XFqXjNjPN2vwA3jay7TS79S4FHksjjrODdD/p4oTvpg=";
|
|
|
|
|
|
|
|
doCheck = false;
|
2020-03-26 10:30:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
inherit pname version src;
|
|
|
|
|
|
|
|
buildPhase = ''
|
2022-03-26 07:48:16 +00:00
|
|
|
mvn -Plinux package --offline -Dmaven.test.skip=true -Dmaven.repo.local=$(cp -dpR ${deps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2
|
2020-03-26 10:30:37 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2021-11-15 19:26:14 +00:00
|
|
|
mkdir -p $out/bin/ $out/share/cryptomator/libs/ $out/share/cryptomator/mods/
|
|
|
|
|
|
|
|
cp target/libs/* $out/share/cryptomator/libs/
|
|
|
|
cp target/mods/* target/cryptomator-*.jar $out/share/cryptomator/mods/
|
2020-03-26 10:30:37 +00:00
|
|
|
|
2021-11-15 19:26:14 +00:00
|
|
|
# The bundeled jffi.so dosn't work on nixos and causes a segmentation fault
|
|
|
|
# we thus replace it with a version build by nixos
|
|
|
|
rm $out/share/cryptomator/libs/jff*.jar
|
|
|
|
cp -f ${jffi}/share/java/jffi-complete.jar $out/share/cryptomator/libs/
|
2020-03-26 10:30:37 +00:00
|
|
|
|
|
|
|
makeWrapper ${jre}/bin/java $out/bin/cryptomator \
|
2021-11-15 19:26:14 +00:00
|
|
|
--add-flags "--class-path '$out/share/cryptomator/libs/*'" \
|
|
|
|
--add-flags "--module-path '$out/share/cryptomator/mods'" \
|
2020-03-26 10:30:37 +00:00
|
|
|
--add-flags "-Dcryptomator.settingsPath='~/.config/Cryptomator/settings.json'" \
|
2021-11-15 19:26:14 +00:00
|
|
|
--add-flags "-Dcryptomator.ipcSocketPath='~/.config/Cryptomator/ipc.socket'" \
|
2020-03-26 10:30:37 +00:00
|
|
|
--add-flags "-Dcryptomator.logDir='~/.local/share/Cryptomator/logs'" \
|
|
|
|
--add-flags "-Dcryptomator.mountPointsDir='~/.local/share/Cryptomator/mnt'" \
|
|
|
|
--add-flags "-Djdk.gtk.version=3" \
|
|
|
|
--add-flags "-Xss20m" \
|
|
|
|
--add-flags "-Xmx512m" \
|
2021-11-15 19:26:14 +00:00
|
|
|
--add-flags "-Djavafx.embed.singleThread=true " \
|
|
|
|
--add-flags "-Dawt.useSystemAAFontSettings=on" \
|
|
|
|
--add-flags "--module org.cryptomator.desktop/org.cryptomator.launcher.Cryptomator" \
|
|
|
|
--prefix PATH : "$out/share/cryptomator/libs/:${lib.makeBinPath [ jre glib ]}" \
|
2020-03-26 10:30:37 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ fuse ]}" \
|
|
|
|
--set JAVA_HOME "${jre.home}"
|
|
|
|
|
|
|
|
# install desktop entry and icons
|
2021-11-15 19:26:14 +00:00
|
|
|
cp -r ${src}/dist/linux/appimage/resources/AppDir/usr/* $out/
|
2020-03-26 10:30:37 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ autoPatchelfHook maven makeWrapper wrapGAppsHook jdk ];
|
2021-11-15 19:26:14 +00:00
|
|
|
buildInputs = [ fuse jre glib jffi ];
|
2020-03-26 10:30:37 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Free client-side encryption for your cloud files";
|
|
|
|
homepage = "https://cryptomator.org";
|
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
maintainers = with maintainers; [ bachp ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|