cryptomator: convert to mavenfod

This commit is contained in:
Weijia Wang 2023-06-20 15:15:57 +03:00
parent 50847470ba
commit 570c2535e5

View File

@ -1,10 +1,10 @@
{ lib, stdenv, fetchFromGitHub
{ lib, javaPackages, fetchFromGitHub
, autoPatchelfHook
, fuse3
, maven, jdk, makeShellWrapper, glib, wrapGAppsHook
}:
let
javaPackages.mavenfod rec {
pname = "cryptomator";
version = "1.8.0";
@ -12,43 +12,15 @@ let
owner = "cryptomator";
repo = "cryptomator";
rev = version;
sha256 = "sha256-4MjF2PDH0JB1biY4HO2wOC0i6EIGSlzkK6tDm8nzvIo=";
hash = "sha256-4MjF2PDH0JB1biY4HO2wOC0i6EIGSlzkK6tDm8nzvIo=";
};
# 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;
mvnParameters = "-Dmaven.test.skip=true";
mvnHash = "sha256-rHLLYkZq3GGE0uhTgZT0tnsh+ChzQdpQ2e+SG1TwBvw=";
nativeBuildInputs = [ jdk maven ];
buildInputs = [ jdk ];
buildPhase = ''
while mvn -Plinux package -Dmaven.test.skip=true -Dmaven.repo.local=$out/.m2 -Dmaven.wagon.rto=5000; [ $? = 1 ]; do
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\+$//' {} \;
'';
outputHashMode = "recursive";
outputHash = "sha256-2nCaSL7OlS9f+PZPh0YiMvnjOaAqlQimkKWDSjSP+bQ=";
doCheck = false;
};
in stdenv.mkDerivation rec {
inherit pname version src;
buildPhase = ''
preBuild = ''
VERSION=${version}
SEMVER_STR=${version}
mvn -Plinux package --offline -Dmaven.test.skip=true -Dmaven.repo.local=$(cp -dpR ${deps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2
'';