toxic: 0.15.1 -> 0.16.0
[NixPkgs.git] / pkgs / by-name / pr / proton-pass / package.nix
blobc92a2c09b4e7de6c63ea3602b5a191dd0e136ed4
2   lib,
3   stdenvNoCC,
4   fetchurl,
5   dpkg,
6   makeWrapper,
7   electron,
8   asar,
9 }:
10 stdenvNoCC.mkDerivation (finalAttrs: {
11   pname = "proton-pass";
12   version = "1.25.0";
14   src = fetchurl {
15     url = "https://proton.me/download/pass/linux/x64/proton-pass_${finalAttrs.version}_amd64.deb";
16     hash = "sha256-gilHkk9vVxnYJKy79lDrlMd8uWys50TEUbGaHVr958o=";
17   };
19   dontConfigure = true;
20   dontBuild = true;
22   nativeBuildInputs = [
23     dpkg
24     makeWrapper
25     asar
26   ];
28   # Rebuild the ASAR archive, hardcoding the resourcesPath
29   preInstall = ''
30     asar extract usr/lib/proton-pass/resources/app.asar tmp
31     rm usr/lib/proton-pass/resources/app.asar
32     substituteInPlace tmp/.webpack/main/index.js \
33       --replace-fail "process.resourcesPath" "'$out/share/proton-pass'"
34     asar pack tmp/ usr/lib/proton-pass/resources/app.asar
35     rm -fr tmp
36   '';
38   installPhase = ''
39     runHook preInstall
40     mkdir -p $out/share/proton-pass
41     cp -r usr/share/ $out/
42     cp -r usr/lib/proton-pass/resources/{app.asar,assets} $out/share/proton-pass/
43     runHook postInstall
44   '';
46   preFixup = ''
47     makeWrapper ${lib.getExe electron} $out/bin/proton-pass \
48       --add-flags $out/share/proton-pass/app.asar \
49       --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
50       --set-default ELECTRON_FORCE_IS_PACKAGED 1 \
51       --set-default ELECTRON_IS_DEV 0 \
52       --inherit-argv0
53   '';
55   meta = {
56     description = "Desktop application for Proton Pass";
57     homepage = "https://proton.me/pass";
58     license = lib.licenses.gpl3Plus;
59     maintainers = with lib.maintainers; [
60       luftmensch-luftmensch
61       massimogengarelli
62       sebtm
63     ];
64     platforms = [ "x86_64-linux" ];
65     sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
66     mainProgram = "proton-pass";
67   };