2024-07-01 15:47:52 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchurl,
|
|
|
|
makeWrapper,
|
|
|
|
dpkg,
|
|
|
|
electron,
|
|
|
|
unzip,
|
2024-04-21 15:54:59 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
mainProgram = "proton-mail";
|
2024-07-27 06:49:29 +00:00
|
|
|
srcHashes = {
|
|
|
|
# Upstream info: It's intended to stay like this in further releases
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/326152#discussion_r1679558135
|
2024-09-19 14:19:46 +00:00
|
|
|
universal-darwin = "sha256-6b+CNCvrkIA1CvSohSJZq/veZZNsA3lyhVv5SsBlJlw=";
|
|
|
|
x86_64-linux = "sha256-v8ufnQQEqTT5cr7fq8Fozje/NDlBzaCeKIzE6yU/biE=";
|
2024-07-27 06:49:29 +00:00
|
|
|
};
|
|
|
|
|
2024-07-01 15:47:52 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2024-04-21 15:54:59 +00:00
|
|
|
pname = "protonmail-desktop";
|
2024-07-27 06:49:29 +00:00
|
|
|
# Upstream info: "v"-prefix got dropped
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "1.0.6";
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url =
|
2024-09-26 11:04:55 +00:00
|
|
|
if stdenv.hostPlatform.isDarwin then
|
2024-07-27 06:49:29 +00:00
|
|
|
"https://github.com/ProtonMail/inbox-desktop/releases/download/${version}/Proton.Mail-darwin-universal-${version}.zip"
|
|
|
|
else
|
|
|
|
"https://github.com/ProtonMail/inbox-desktop/releases/download/${version}/proton-mail_${version}_amd64.deb";
|
|
|
|
sha256 =
|
|
|
|
{
|
|
|
|
x86_64-linux = srcHashes.x86_64-linux;
|
|
|
|
x86_64-darwin = srcHashes.universal-darwin;
|
|
|
|
aarch64-darwin = srcHashes.universal-darwin;
|
|
|
|
}
|
|
|
|
.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}");
|
|
|
|
};
|
2024-07-01 15:47:52 +00:00
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
sourceRoot = lib.optionalString stdenv.hostPlatform.isDarwin ".";
|
2024-04-21 15:54:59 +00:00
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
nativeBuildInputs =
|
|
|
|
[
|
|
|
|
makeWrapper
|
|
|
|
]
|
|
|
|
++ lib.optional stdenv.hostPlatform.isLinux dpkg ++ lib.optional stdenv.hostPlatform.isDarwin unzip;
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2024-07-01 15:47:52 +00:00
|
|
|
installPhase =
|
2024-07-27 06:49:29 +00:00
|
|
|
let
|
|
|
|
darwin = ''
|
|
|
|
mkdir -p $out/{Applications,bin}
|
|
|
|
cp -r "Proton Mail.app" $out/Applications/
|
|
|
|
makeWrapper $out/Applications/"Proton Mail.app"/Contents/MacOS/Proton\ Mail $out/bin/protonmail-desktop
|
|
|
|
'';
|
|
|
|
linux = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out
|
|
|
|
cp -r usr/share/ $out/
|
|
|
|
cp -r usr/lib/proton-mail/resources/app.asar $out/share/
|
|
|
|
'';
|
|
|
|
|
|
|
|
in
|
2024-07-01 15:47:52 +00:00
|
|
|
''
|
|
|
|
runHook preInstall
|
2024-07-27 06:49:29 +00:00
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
${if stdenv.hostPlatform.isDarwin then darwin else linux}
|
2024-07-27 06:49:29 +00:00
|
|
|
|
2024-07-01 15:47:52 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
|
2024-04-21 15:54:59 +00:00
|
|
|
makeWrapper ${lib.getExe electron} $out/bin/${mainProgram} \
|
|
|
|
--add-flags $out/share/app.asar \
|
|
|
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
|
|
|
|
--set-default ELECTRON_FORCE_IS_PACKAGED 1 \
|
|
|
|
--set-default ELECTRON_IS_DEV 0 \
|
|
|
|
--inherit-argv0
|
|
|
|
'';
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
|
|
|
meta = {
|
2024-04-21 15:54:59 +00:00
|
|
|
description = "Desktop application for Mail and Calendar, made with Electron";
|
|
|
|
homepage = "https://github.com/ProtonMail/inbox-desktop";
|
2024-07-27 06:49:29 +00:00
|
|
|
license = lib.licenses.gpl3Plus;
|
|
|
|
maintainers = with lib.maintainers; [
|
2024-07-01 15:47:52 +00:00
|
|
|
rsniezek
|
|
|
|
sebtm
|
|
|
|
matteopacini
|
|
|
|
];
|
2024-07-27 06:49:29 +00:00
|
|
|
platforms = [
|
|
|
|
"x86_64-linux"
|
|
|
|
"x86_64-darwin"
|
|
|
|
"aarch64-darwin"
|
|
|
|
];
|
|
|
|
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
|
2024-04-21 15:54:59 +00:00
|
|
|
inherit mainProgram;
|
|
|
|
};
|
|
|
|
}
|