evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / by-name / ji / jitsi-meet-electron / package.nix
blob619759df2f0080e9eabdd52bbdb9fb453d54eac8
1 { lib
2 , stdenv
3 , buildNpmPackage
4 , fetchFromGitHub
5 , copyDesktopItems
6 , makeDesktopItem
7 , makeWrapper
8 , libpng
9 , libX11
10 , libXi
11 , libXtst
12 , zlib
13 , darwin
14 , electron
17 let
18   inherit (darwin.apple_sdk.frameworks) Carbon CoreFoundation ApplicationServices OpenGL;
20 buildNpmPackage rec {
21   pname = "jitsi-meet-electron";
22   version = "2024.6.0";
24   src = fetchFromGitHub {
25     owner = "jitsi";
26     repo = "jitsi-meet-electron";
27     rev = "v${version}";
28     hash = "sha256-jnt+aHkCnIj4GGFbAk6AlVhg0rvzFhGCELAaYMCZx88=";
29   };
31   nativeBuildInputs = [
32     makeWrapper
33   ] ++ lib.optionals stdenv.hostPlatform.isLinux [
34     copyDesktopItems
35   ];
37   # robotjs node-gyp dependencies
38   buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
39     libpng
40     libX11
41     libXi
42     libXtst
43     zlib
44   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
45     Carbon
46     CoreFoundation
47     ApplicationServices
48     OpenGL
49   ];
51   npmDepsHash = "sha256-zmnxNJdalspZib1PGZN0YBIauJ+gaxs6Iir94cPRNtU=";
53   makeCacheWritable = true;
55   env.ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
57   # disable code signing on Darwin
58   env.CSC_IDENTITY_AUTO_DISCOVERY = "false";
60   preBuild = ''
61     # remove some prebuilt binaries
62     find node_modules -type d -name prebuilds -exec rm -r {} +
64     # don't force both darwin architectures together
65     substituteInPlace node_modules/@jitsi/robotjs/binding.gyp \
66         --replace-fail "-arch x86_64" "" \
67         --replace-fail "-arch arm64" ""
68   '';
70   postBuild = ''
71     cp -r ${electron.dist} electron-dist
72     chmod -R u+w electron-dist
74     # npmRebuild is needed because robotjs won't be built on darwin otherwise
75     # asarUnpack makes sure to unwrap binaries so that nix can see the RPATH
76     npm exec electron-builder -- \
77         --dir \
78         -c.npmRebuild=true \
79         -c.asarUnpack="**/*.node" \
80         -c.electronDist=electron-dist \
81         -c.electronVersion=${electron.version}
82   '';
84   installPhase = ''
85     runHook preInstall
87     ${lib.optionalString stdenv.hostPlatform.isLinux ''
88       mkdir -p $out/share/jitsi-meet-electron
89       cp -r dist/*-unpacked/{locales,resources{,.pak}} $out/share/jitsi-meet-electron
91       makeWrapper ${lib.getExe electron} $out/bin/jitsi-meet-electron \
92           --add-flags $out/share/jitsi-meet-electron/resources/app.asar \
93           --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
94           --set-default ELECTRON_IS_DEV 0 \
95           --inherit-argv0
97       install -Dm644 resources/icons/512x512.png $out/share/icons/hicolor/512x512/apps/jitsi-meet-electron.png
98     ''}
100     ${lib.optionalString stdenv.hostPlatform.isDarwin ''
101       mkdir -p $out/Applications
102       cp -r dist/mac*/"Jitsi Meet.app" $out/Applications
103       makeWrapper "$out/Applications/Jitsi Meet.app/Contents/MacOS/Jitsi Meet" $out/bin/jitsi-meet-electron
104     ''}
106     runHook postInstall
107   '';
109   desktopItems = [
110     (makeDesktopItem {
111       name = "jitsi-meet-electron";
112       exec = "jitsi-meet-electron %U";
113       icon = "jitsi-meet-electron";
114       desktopName = "Jitsi Meet";
115       comment = meta.description;
116       categories = [ "VideoConference" "AudioVideo" "Audio" "Video" "Network" ];
117       mimeTypes = [ "x-scheme-handler/jitsi-meet" ];
118       terminal = false;
119     })
120   ];
122   meta = with lib; {
123     changelog = "https://github.com/jitsi/jitsi-meet-electron/releases/tag/${src.rev}";
124     description = "Jitsi Meet desktop application powered by Electron";
125     homepage = "https://github.com/jitsi/jitsi-meet-electron";
126     license = licenses.asl20;
127     mainProgram = "jitsi-meet-electron";
128     maintainers = teams.jitsi.members ++ [ maintainers.tomasajt ];
129     inherit (electron.meta) platforms;
130   };