summaryrefslogtreecommitdiff
path: root/pkgs/by-name/an/anydesk/package.nix
blob: 6a7f5dd81eae7872edf7580457e2f1954684e2fe (about) (plain)
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
{
  lib,
  stdenv,
  fetchurl,
  makeWrapper,
  makeDesktopItem,
  genericUpdater,
  writeShellScript,
  atk,
  cairo,
  gdk-pixbuf,
  glib,
  gtk3,
  dbus,
  harfbuzz,
  libz,
  libGLU,
  libGL,
  pango,
  xorg,
  minizip,
  lsb-release,
  freetype,
  fontconfig,
  polkit,
  polkit_gnome,
  pciutils,
  copyDesktopItems,
  pulseaudio,
}:

let
  description = "Desktop sharing application, providing remote support and online meetings";
in
stdenv.mkDerivation (finalAttrs: {
  pname = "anydesk";
  version = "6.4.2";

  src = fetchurl {
    urls = [
      "https://download.anydesk.com/linux/anydesk-${finalAttrs.version}-amd64.tar.gz"
      "https://download.anydesk.com/linux/generic-linux/anydesk-${finalAttrs.version}-amd64.tar.gz"
    ];
    hash = "sha256-KJTyIMuKNLymD/DsitN+Rgro7lgkY13fmkFNxsEUkWU=";
  };

  buildInputs =
    [
      atk
      cairo
      gdk-pixbuf
      glib
      gtk3
      dbus
      harfbuzz
      libz
      stdenv.cc.cc
      pango
      libGLU
      libGL
      minizip
      freetype
      fontconfig
      polkit
      polkit_gnome
      pulseaudio
    ]
    ++ (with xorg; [
      libxcb
      libxkbfile
      libX11
      libXdamage
      libXext
      libXfixes
      libXi
      libXmu
      libXrandr
      libXtst
      libXt
      libICE
      libSM
      libXrender
    ]);

  nativeBuildInputs = [
    copyDesktopItems
    makeWrapper
  ];

  desktopItems = [
    (makeDesktopItem {
      name = "AnyDesk";
      exec = "anydesk %u";
      icon = "anydesk";
      desktopName = "AnyDesk";
      genericName = description;
      categories = [ "Network" ];
      startupNotify = false;
    })
  ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin $out/share/{applications,doc/anydesk,icons/hicolor}
    install -m755 anydesk $out/bin/anydesk
    cp copyright README $out/share/doc/anydesk
    cp -r icons/hicolor/* $out/share/icons/hicolor/

    runHook postInstall
  '';

  postFixup = ''
    patchelf \
      --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
      --set-rpath "${lib.makeLibraryPath finalAttrs.buildInputs}" \
      $out/bin/anydesk

    wrapProgram $out/bin/anydesk \
      --prefix PATH : ${
        lib.makeBinPath [
          lsb-release
          pciutils
        ]
      } \
      --prefix GDK_BACKEND : x11 \
      --set GTK_THEME Adwaita
  '';

  passthru = {
    updateScript = genericUpdater {
      versionLister = writeShellScript "anydesk-versionLister" ''
        curl -s https://anydesk.com/en/downloads/linux \
          | grep "https://[a-z0-9._/-]*-amd64.tar.gz" -o \
          | uniq \
          | sed 's,.*/anydesk-\(.*\)-amd64.tar.gz,\1,g'
      '';
    };
  };

  meta = {
    inherit description;
    homepage = "https://www.anydesk.com";
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    license = lib.licenses.unfree;
    platforms = [ "x86_64-linux" ];
    maintainers = with lib.maintainers; [
      shyim
    ];
  };
})