12 mainProgram = "proton-mail";
14 # Upstream info: It's intended to stay like this in further releases
15 # https://github.com/NixOS/nixpkgs/pull/326152#discussion_r1679558135
16 universal-darwin = "sha256-6b+CNCvrkIA1CvSohSJZq/veZZNsA3lyhVv5SsBlJlw=";
17 x86_64-linux = "sha256-v8ufnQQEqTT5cr7fq8Fozje/NDlBzaCeKIzE6yU/biE=";
21 stdenv.mkDerivation rec {
22 pname = "protonmail-desktop";
23 # Upstream info: "v"-prefix got dropped
28 if stdenv.hostPlatform.isDarwin then
29 "https://github.com/ProtonMail/inbox-desktop/releases/download/${version}/Proton.Mail-darwin-universal-${version}.zip"
31 "https://github.com/ProtonMail/inbox-desktop/releases/download/${version}/proton-mail_${version}_amd64.deb";
34 x86_64-linux = srcHashes.x86_64-linux;
35 x86_64-darwin = srcHashes.universal-darwin;
36 aarch64-darwin = srcHashes.universal-darwin;
38 .${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}");
41 sourceRoot = lib.optionalString stdenv.hostPlatform.isDarwin ".";
50 ++ lib.optional stdenv.hostPlatform.isLinux dpkg ++ lib.optional stdenv.hostPlatform.isDarwin unzip;
55 mkdir -p $out/{Applications,bin}
56 cp -r "Proton Mail.app" $out/Applications/
57 makeWrapper $out/Applications/"Proton Mail.app"/Contents/MacOS/Proton\ Mail $out/bin/protonmail-desktop
62 cp -r usr/share/ $out/
63 cp -r usr/lib/proton-mail/resources/app.asar $out/share/
70 ${if stdenv.hostPlatform.isDarwin then darwin else linux}
75 preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
76 makeWrapper ${lib.getExe electron} $out/bin/${mainProgram} \
77 --add-flags $out/share/app.asar \
78 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
79 --set-default ELECTRON_FORCE_IS_PACKAGED 1 \
80 --set-default ELECTRON_IS_DEV 0 \
84 passthru.updateScript = ./update.sh;
87 description = "Desktop application for Mail and Calendar, made with Electron";
88 homepage = "https://github.com/ProtonMail/inbox-desktop";
89 license = lib.licenses.gpl3Plus;
90 maintainers = with lib.maintainers; [
100 sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];