summary refs log tree commit diff
path: root/pkgs/applications/audio/netease-cloud-music/default.nix
blob: 15afe233b3abc67c33b06b63bfa65547b42aaa73 (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
{ stdenv, lib, fontconfig, zlib, libGL, glib, pango
, gdk-pixbuf, freetype, atk, cairo, libsForQt5, xorg
, sqlite, taglib, nss, nspr, cups, dbus, alsaLib
, libpulseaudio, deepin, qt5, harfbuzz, p11-kit
, libgpgerror, libudev0-shim, makeWrapper, dpkg, fetchurl }:
let
  rpath = lib.makeLibraryPath [
    fontconfig.lib
    zlib
    stdenv.cc.cc.lib
    libGL
    glib
    pango
    gdk-pixbuf
    freetype
    atk
    cairo
    libsForQt5.vlc
    sqlite
    taglib
    nss
    nspr
    cups.lib
    dbus.lib
    alsaLib
    libpulseaudio
    xorg.libX11
    xorg.libXext
    xorg.libXtst
    xorg.libXdamage
    xorg.libXScrnSaver
    xorg.libxcb
    xorg.libXi
    deepin.qcef
    qt5.qtwebchannel
    qt5.qtbase
    qt5.qtx11extras
    qt5.qtdeclarative
    harfbuzz
    p11-kit
    libgpgerror
  ];   

  runtimeLibs = lib.makeLibraryPath [ libudev0-shim ];

in stdenv.mkDerivation rec {
  pname = "netease-cloud-music";
  version = "1.2.0";
  src = fetchurl {
    url    = "http://d1.music.126.net/dmusic/netease-cloud-music_1.2.0_amd64_deepin_stable_20190424.deb";
    sha256 = "0hg8jqim77vd0fmk8gfbz2fmlj99byxcm9jn70xf7vk1sy7wp6h1";
    curlOpts = "-A 'Mozilla/5.0'";
  };
  unpackCmd = "${dpkg}/bin/dpkg -x $src .";
  sourceRoot = ".";

  nativeBuildInputs = [ qt5.wrapQtAppsHook makeWrapper ];

  installPhase = ''
    mkdir -p $out
    cp -r usr/* $out
  '';

  preFixup = ''
    local exefile="$out/bin/netease-cloud-music"
    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$exefile"
    patchelf --set-rpath "$out/libs:$(patchelf --print-rpath "$exefile"):${rpath}" "$exefile"

    wrapProgram $out/bin/netease-cloud-music \
      --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
      --set QCEF_INSTALL_PATH "${deepin.qcef}/lib/qcef"
  '';

  meta = {
    description = "Client for Netease Cloud Music service";
    homepage = https://music.163.com;
    platforms = [ "i686-linux" "x86_64-linux" ];
    maintainers = [ stdenv.lib.maintainers.mlatus ];
    license = stdenv.lib.licenses.unfreeRedistributable;
  };
}