anchor.diff:      inherit src;
   
       nativeBuildInputs = [ jdk maven ];
  +    buildInputs = [ jre ];
   
       buildPhase = ''
  -      cd main
  -      while mvn -Prelease package -Dmaven.repo.local=$out/.m2 -Dmaven.wagon.rto=5000; [ $? = 1 ]; do
  +      while mvn -Plinux package -Dmaven.repo.local=$out/.m2 -Dmaven.wagon.rto=5000; [ $? = 1 ]; do
           echo "timeout, restart maven to continue downloading"
         done
       '';
  
positive.code: 
      outputHashAlgo = "sha256";
      outputHashMode = "recursive";
      outputHash = "195ysv9l861y9d1lvmvi7wmk172ynlba9n233blpaigq88cjn208";
    };
  
  in stdenv.mkDerivation rec {
    inherit pname version src;
  
    buildPhase = ''
      cd main
      mvn -Prelease package --offline -Dmaven.repo.local=$(cp -dpR ${deps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2
    '';
  
    installPhase = ''
      mkdir -p $out/bin/ $out/usr/share/cryptomator/libs/
  
      cp buildkit/target/libs/* buildkit/target/linux-libs/* $out/usr/share/cryptomator/libs/
  
      makeWrapper ${jre}/bin/java $out/bin/cryptomator \
        --add-flags "-classpath '$out/usr/share/cryptomator/libs/*'" \
        --add-flags "-Dcryptomator.settingsPath='~/.config/Cryptomator/settings.json'" \
        --add-flags "-Dcryptomator.ipcPortPath='~/.config/Cryptomator/ipcPort.bin'" \
        --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" \
        --add-flags "org.cryptomator.launcher.Cryptomator" \
        --prefix PATH : "$out/usr/share/cryptomator/libs/:${lib.makeBinPath [ jre glib ]}" \
        --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ fuse ]}" \
        --set JAVA_HOME "${jre.home}"
  
      # install desktop entry and icons
      cp -r ${icons}/resources/appimage/AppDir/usr/* $out/
    '';
  
    nativeBuildInputs = [ autoPatchelfHook maven makeWrapper wrapGAppsHook jdk ];
    buildInputs = [ fuse packer jre glib ];
  
    meta = with lib; {
      description = "Free client-side encryption for your cloud files";
  
negative.code: { lib, stdenv, fetchFromGitHub
  , autoPatchelfHook
  , fuse, jffi
  , maven, jdk, jre, makeWrapper, glib, wrapGAppsHook
  }:
  
  let
    pname = "cryptomator";
    version = "1.6.5";
  
    src = fetchFromGitHub {
      owner = "cryptomator";
      repo = "cryptomator";
      rev = version;
      sha256 = "sha256-6Z1GwrOsjjG546ZS+v/q4WL4tHgYPvMga8x4DY+unJs=";
    };
  
    # perform fake build to make a fixed-output derivation out of the files downloaded from maven central (120MB)
  