biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / tools / security / cryptomator / default.nix
blob084e9d9b1c3561db9e767cd9fca4fcb3f1fb1de7
1 { lib, fetchFromGitHub
2 , autoPatchelfHook
3 , fuse3
4 , maven, jdk, makeShellWrapper, glib, wrapGAppsHook3
5 , libayatana-appindicator
6 }:
8 maven.buildMavenPackage rec {
9   pname = "cryptomator";
10   version = "1.14.1";
12   src = fetchFromGitHub {
13     owner = "cryptomator";
14     repo = "cryptomator";
15     rev = version;
16     hash = "sha256-so8RINjFLF9H4K9f/60Ym/v/VpcVfxJ/c+JDOAPFgZU=";
17   };
19   mvnJdk = jdk;
20   mvnParameters = "-Dmaven.test.skip=true -Plinux";
21   mvnHash = "sha256-aB7wgnJAYvCizC0/gG/amcId/WVVWmZndItm398nDfQ=";
23   preBuild = ''
24     VERSION=${version}
25     SEMVER_STR=${version}
26   '';
28   # This is based on the instructins in https://github.com/cryptomator/cryptomator/blob/develop/dist/linux/appimage/build.sh
29   installPhase = ''
30     runHook preInstall
32     mkdir -p $out/bin/ $out/share/cryptomator/libs/ $out/share/cryptomator/mods/
34     cp target/libs/* $out/share/cryptomator/libs/
35     cp target/mods/* target/cryptomator-*.jar $out/share/cryptomator/mods/
37     makeShellWrapper ${jdk}/bin/java $out/bin/${pname} \
38       --add-flags "--enable-preview" \
39       --add-flags "--enable-native-access=org.cryptomator.jfuse.linux.amd64,org.purejava.appindicator" \
40       --add-flags "--class-path '$out/share/cryptomator/libs/*'" \
41       --add-flags "--module-path '$out/share/cryptomator/mods'" \
42       --add-flags "-Dfile.encoding='utf-8'" \
43       --add-flags "-Dcryptomator.logDir='@{userhome}/.local/share/Cryptomator/logs'" \
44       --add-flags "-Dcryptomator.pluginDir='@{userhome}/.local/share/Cryptomator/plugins'" \
45       --add-flags "-Dcryptomator.settingsPath='@{userhome}/.config/Cryptomator/settings.json'" \
46       --add-flags "-Dcryptomator.p12Path='@{userhome}/.config/Cryptomator/key.p12'" \
47       --add-flags "-Dcryptomator.ipcSocketPath='@{userhome}/.config/Cryptomator/ipc.socket'" \
48       --add-flags "-Dcryptomator.mountPointsDir='@{userhome}/.local/share/Cryptomator/mnt'" \
49       --add-flags "-Dcryptomator.showTrayIcon=true" \
50       --add-flags "-Dcryptomator.buildNumber='nix-${src.rev}'" \
51       --add-flags "-Dcryptomator.appVersion='${version}'" \
52       --add-flags "-Djava.net.useSystemProxies=true" \
53       --add-flags "-Xss20m" \
54       --add-flags "-Xmx512m" \
55       --add-flags "-Dcryptomator.disableUpdateCheck=true" \
56       --add-flags "-Dcryptomator.integrationsLinux.trayIconsDir='$out/share/icons/hicolor/symbolic/apps'" \
57       --add-flags "--module org.cryptomator.desktop/org.cryptomator.launcher.Cryptomator" \
58       --prefix PATH : "$out/share/cryptomator/libs/:${lib.makeBinPath [ jdk glib ]}" \
59       --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ fuse3 libayatana-appindicator ]}" \
60       --set JAVA_HOME "${jdk.home}"
62     # install desktop entry and icons
63     cp -r ${src}/dist/linux/appimage/resources/AppDir/usr/* $out/
64     # The directory is read only when copied, enable read to install additional files
65     chmod +w -R $out/
66     cp ${src}/dist/linux/common/org.cryptomator.Cryptomator256.png $out/share/icons/hicolor/256x256/apps/org.cryptomator.Cryptomator.png
67     cp ${src}/dist/linux/common/org.cryptomator.Cryptomator512.png $out/share/icons/hicolor/512x512/apps/org.cryptomator.Cryptomator.png
68     cp ${src}/dist/linux/common/org.cryptomator.Cryptomator.svg $out/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.svg
69     cp ${src}/dist/linux/common/org.cryptomator.Cryptomator.tray-unlocked.svg $out/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.tray-unlocked.svg
70     cp ${src}/dist/linux/common/org.cryptomator.Cryptomator.tray.svg $out/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.tray.svg
71     cp ${src}/dist/linux/common/org.cryptomator.Cryptomator.tray-unlocked.svg $out/share/icons/hicolor/symbolic/apps/org.cryptomator.Cryptomator.tray-unlocked-symbolic.svg
72     cp ${src}/dist/linux/common/org.cryptomator.Cryptomator.tray.svg $out/share/icons/hicolor/symbolic/apps/org.cryptomator.Cryptomator.tray-symbolic.svg
73     cp ${src}/dist/linux/common/org.cryptomator.Cryptomator.desktop $out/share/applications/org.cryptomator.Cryptomator.desktop
74     cp ${src}/dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml $out/share/metainfo/org.cryptomator.Cryptomator.metainfo.xml
75     cp ${src}/dist/linux/common/application-vnd.cryptomator.vault.xml $out/share/mime/packages/application-vnd.cryptomator.vault.xml
77     runHook postInstall
78   '';
80   nativeBuildInputs = [
81     autoPatchelfHook
82     makeShellWrapper
83     wrapGAppsHook3
84     jdk
85   ];
86   buildInputs = [ fuse3 jdk glib libayatana-appindicator ];
88   meta = with lib; {
89     description = "Free client-side encryption for your cloud files";
90     mainProgram = "cryptomator";
91     homepage = "https://cryptomator.org";
92     sourceProvenance = with sourceTypes; [
93       fromSource
94       binaryBytecode  # deps
95     ];
96     license = licenses.gpl3Plus;
97     maintainers = with maintainers; [ bachp ];
98     platforms = [ "x86_64-linux" ];
99   };