about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/instant-messengers/bluejeans/default.nix
blob: bca1a1affc0d0292ee59afb537d90bc7cb504b8b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{ stdenv
, lib
, fetchurl
, rpmextract
, libnotify
, libuuid
, cairo
, cups
, pango
, fontconfig
, udev
, dbus
, gtk3
, atk
, at-spi2-atk
, expat
, gdk-pixbuf
, freetype
, nspr
, glib
, nss
, libX11
, libXrandr
, libXrender
, libXtst
, libXdamage
, libxcb
, libXcursor
, libXi
, libXext
, libXfixes
, libXft
, libXcomposite
, libXScrnSaver
, alsa-lib
, pulseaudio
, makeWrapper
, xdg-utils
}:

let
  getFirst = n: v: builtins.concatStringsSep "." (lib.take n (lib.splitString "." v));
in

stdenv.mkDerivation rec {
  pname = "bluejeans";
  version = "2.23.0.39";

  src = fetchurl {
    url = "https://swdl.bluejeans.com/desktop-app/linux/${getFirst 3 version}/BlueJeans_${version}.rpm";
    sha256 = "sha256-LGg14KJ/hEnSaSrdTltY9YXv7Nekkfo66uLkxjMx8AI=";
  };

  nativeBuildInputs = [ rpmextract makeWrapper ];

  libPath =
    lib.makeLibraryPath
      [
        libnotify
        libuuid
        cairo
        cups
        pango
        fontconfig
        gtk3
        atk
        at-spi2-atk
        expat
        gdk-pixbuf
        dbus
        (lib.getLib udev)
        freetype
        nspr
        glib
        stdenv.cc.cc.lib
        nss
        libX11
        libXrandr
        libXrender
        libXtst
        libXdamage
        libxcb
        libXcursor
        libXi
        libXext
        libXfixes
        libXft
        libXcomposite
        libXScrnSaver
        alsa-lib
        pulseaudio
      ];

  localtime64_stub = ./localtime64_stub.c;

  buildCommand = ''
    mkdir -p $out/bin/
    cd $out
    rpmextract $src
    mv usr/share share
    rmdir usr

    patchelf \
      --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
      --replace-needed libudev.so.0 libudev.so.1 \
      opt/BlueJeans/bluejeans-v2

    patchelf \
      --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
      opt/BlueJeans/resources/BluejeansHelper

    cc $localtime64_stub -shared -o "${placeholder "out"}"/opt/BlueJeans/liblocaltime64_stub.so

    makeWrapper $out/opt/BlueJeans/bluejeans-v2 $out/bin/bluejeans \
      --set LD_LIBRARY_PATH "${libPath}":"${placeholder "out"}"/opt/BlueJeans \
      --set LD_PRELOAD "$out"/opt/BlueJeans/liblocaltime64_stub.so \
      --prefix PATH : ${lib.makeBinPath [ xdg-utils ]}

    substituteInPlace "$out"/share/applications/bluejeans-v2.desktop \
      --replace "/opt/BlueJeans/bluejeans-v2" "$out/bin/bluejeans"

    patchShebangs "$out"
  '';

  passthru.updateScript = ./update.sh;

  meta = with lib; {
    description = "Video, audio, and web conferencing that works together with the collaboration tools you use every day";
    homepage = "https://www.bluejeans.com";
    license = licenses.unfree;
    maintainers = with maintainers; [ ];
    platforms = [ "x86_64-linux" ];
  };
}