git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #64931 from toonn/wire-desktop-refactor

wire-desktop: refactor to add Darwin support

commitecc48146daa9a338a643bf858ac61b882d40331f authorworldofpeace <worldofpeace@protonmail.ch> dateSat 27 Jul 2019, 13:48 (7 years ago) parentb5590ff4665e88
1 file changed+115−86
pkgs/applications/networking/instant-messengers/wire-desktop/default.nix+115−86
pkgs/applications/networking/instant-messengers/wire-desktop/default.nix+115−86
@@ -1,103 +1,132 @@
1−{ stdenv, fetchurl, dpkg, makeDesktopItem, libuuid, gtk3, atk, cairo, pango
2−, gdk_pixbuf, glib, freetype, fontconfig, dbus, libnotify, libX11, xorg, libXi
3−, libXcursor, libXdamage, libXrandr, libXcomposite, libXext, libXfixes
4−, libXrender, libXtst, libXScrnSaver, nss, nspr, alsaLib, cups, expat, udev
5−, xdg_utils, hunspell, pulseaudio, pciutils, at-spi2-atk
1+{ stdenv, fetchurl, makeDesktopItem
2+
3+, alsaLib, at-spi2-atk, atk, cairo, cups, dbus, dpkg, expat, fontconfig
4+, freetype, gdk_pixbuf, glib, gtk3, hunspell, libX11, libXScrnSaver
5+, libXcomposite, libXcursor, libXdamage, libXext, libXfixes, libXi, libXrandr
6+, libXrender, libXtst, libnotify, libuuid, nspr, nss, pango, pciutils
7+, pulseaudio, udev, xdg_utils, xorg
8+
9+, cpio, xar
610}:
711
812let
913
10− rpath = stdenv.lib.makeLibraryPath [
11− alsaLib
12− atk
13− cairo
14− cups
15− dbus
16− expat
17− fontconfig
18− freetype
19− gdk_pixbuf
20− glib
21− gtk3
22− at-spi2-atk
23− hunspell
24− libuuid
25− libnotify
26− libX11
27− libXcomposite
28− libXcursor
29− libXdamage
30− libXext
31− libXfixes
32− libXi
33− libXrandr
34− libXrender
35− libXScrnSaver
36− libXtst
37− nspr
38− nss
39− pango
40− pciutils
41− pulseaudio
42− stdenv.cc.cc
43− udev
44− xdg_utils
45− xorg.libxcb
46− ];
47−
48−in
49−
50−stdenv.mkDerivation rec {
14+ inherit (stdenv.hostPlatform) system;
15+
5116 pname = "wire-desktop";
52− version = "3.9.2895";
5317
54− src = fetchurl {
55− url = "https://wire-app.wire.com/linux/debian/pool/main/Wire-${version}_amd64.deb";
56− sha256 = "0wrn95m64j4b7ym44h9zawq13kg4m12aixlyyzp56bfyczmjq4a5";
18+ version = {
19+ "x86_64-linux" = "3.9.2895";
20+ "x86_64-darwin" = "3.9.2943";
21+ }.${system};
22+
23+ sha256 = {
24+ "x86_64-linux" = "0wrn95m64j4b7ym44h9zawq13kg4m12aixlyyzp56bfyczmjq4a5";
25+ "x86_64-darwin" = "1y1bzsjmjrj518q29xfx6gg1nhdbaz7y5hzaqrp241az6plp090k";
26+ }.${system};
27+
28+ meta = with stdenv.lib; {
29+ description = "A modern, secure messenger for everyone";
30+ longDescription = ''
31+ Wire Personal is a secure, privacy-friendly messenger. It combines useful
32+ and fun features, audited security, and a beautiful, distinct user
33+ interface. It does not require a phone number to register and chat.
34+
35+ * End-to-end encrypted chats, calls, and files
36+ * Crystal clear voice and video calling
37+ * File and screen sharing
38+ * Timed messages and chats
39+ * Synced across your phone, desktop and tablet
40+ '';
41+ homepage = https://wire.com/;
42+ downloadPage = https://wire.com/download/;
43+ license = licenses.gpl3Plus;
44+ maintainers = with maintainers; [ toonn worldofpeace ];
45+ platforms = [ "x86_64-darwin" "x86_64-linux" ];
5746 };
5847
59− desktopItem = makeDesktopItem {
60− name = "wire-desktop";
61− exec = "wire-desktop %U";
62− icon = "wire-desktop";
63− comment = "Secure messenger for everyone";
64− desktopName = "Wire Desktop";
65− genericName = "Secure messenger";
66− categories = "Network;InstantMessaging;Chat;VideoConference";
48+ linux = stdenv.mkDerivation rec {
49+ inherit pname version meta;
50+
51+ src = fetchurl {
52+ url = "https://wire-app.wire.com/linux/debian/pool/main/"
53+ + "Wire-${version}_amd64.deb";
54+ inherit sha256;
55+ };
56+
57+ desktopItem = makeDesktopItem {
58+ name = "wire-desktop";
59+ exec = "wire-desktop %U";
60+ icon = "wire-desktop";
61+ comment = "Secure messenger for everyone";
62+ desktopName = "Wire Desktop";
63+ genericName = "Secure messenger";
64+ categories = "Network;InstantMessaging;Chat;VideoConference";
65+ };
66+
67+ dontBuild = true;
68+ dontPatchELF = true;
69+ dontConfigure = true;
70+
71+ nativeBuildInputs = [ dpkg ];
72+ rpath = stdenv.lib.makeLibraryPath [
73+ alsaLib at-spi2-atk atk cairo cups dbus expat fontconfig freetype
74+ gdk_pixbuf glib gtk3 hunspell libX11 libXScrnSaver libXcomposite
75+ libXcursor libXdamage libXext libXfixes libXi libXrandr libXrender
76+ libXtst libnotify libuuid nspr nss pango pciutils pulseaudio
77+ stdenv.cc.cc udev xdg_utils xorg.libxcb
78+ ];
79+
80+ unpackPhase = "dpkg-deb -x $src .";
81+
82+ installPhase = ''
83+ mkdir -p "$out"
84+ cp -R "opt" "$out"
85+ cp -R "usr/share" "$out/share"
86+ chmod -R g-w "$out"
87+
88+ # Patch wire-desktop
89+ patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
90+ --set-rpath "${rpath}:$out/opt/Wire" \
91+ "$out/opt/Wire/wire-desktop"
92+
93+ # Symlink to bin
94+ mkdir -p "$out/bin"
95+ ln -s "$out/opt/Wire/wire-desktop" "$out/bin/wire-desktop"
96+
97+ # Desktop file
98+ mkdir -p "$out/share/applications"
99+ cp "${desktopItem}/share/applications/"* "$out/share/applications"
100+ '';
67101 };
68102
69− dontBuild = true;
70− dontPatchELF = true;
71− dontConfigure = true;
103+ darwin = stdenv.mkDerivation rec {
104+ inherit pname version meta;
72105
73− nativeBuildInputs = [ dpkg ];
74− unpackPhase = "dpkg-deb -x $src .";
75− installPhase = ''
76− mkdir -p "$out"
77− cp -R "opt" "$out"
78− cp -R "usr/share" "$out/share"
106+ src = fetchurl {
107+ url = "https://github.com/wireapp/wire-desktop/releases/download/"
108+ + "macos%2F${version}/Wire.pkg";
109+ inherit sha256;
110+ };
79111
80− chmod -R g-w "$out"
112+ buildInputs = [ cpio xar ];
81113
82− # Patch wire-desktop
83− patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
84− --set-rpath "${rpath}:$out/opt/Wire" \
85− "$out/opt/Wire/wire-desktop"
114+ unpackPhase = ''
115+ xar -xf $src
116+ cd com.wearezeta.zclient.mac.pkg
117+ '';
86118
87− # Symlink to bin
88− mkdir -p "$out/bin"
89− ln -s "$out/opt/Wire/wire-desktop" "$out/bin/wire-desktop"
90119
91− # Desktop file
92− mkdir -p "$out/share/applications"
93− cp "${desktopItem}/share/applications/"* "$out/share/applications"
94− '';
120+ buildPhase = ''
121+ cat Payload | gunzip -dc | cpio -i
122+ '';
95123
96− meta = with stdenv.lib; {
97− description = "A modern, secure messenger";
98− homepage = https://wire.com/;
99− license = licenses.gpl3;
100− maintainers = with maintainers; [ worldofpeace ];
101− platforms = [ "x86_64-linux" ];
124+ installPhase = ''
125+ mkdir -p $out/Applications
126+ cp -r Wire.app $out/Applications
127+ '';
102128 };
103−}
129+
130+in if stdenv.isDarwin
131+ then darwin
132+ else linux