summary refs log tree commit diff
path: root/pkgs/applications/networking/p2p/soulseekqt/default.nix
blob: 44e434aa8ee935af48aeff52ec95f8e7c8c73eb4 (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
{ stdenv
, fetchurl
, dbus
, zlib, fontconfig
, qtbase, qtmultimedia
, libjson, libgpgerror
, libX11, libxcb, libXau, libXdmcp, freetype, libbsd
, pythonPackages, squashfsTools, makeDesktopItem
}:

with stdenv.lib;
let
  libPath = makeLibraryPath
    [ stdenv.cc.cc qtbase qtmultimedia dbus libX11 zlib libX11 libxcb libXau libXdmcp freetype fontconfig libbsd libjson libgpgerror];

  version = "2018-1-30";

  mainbin = "SoulseekQt-" + (version) +"-"+ (if stdenv.is64bit then "64bit" else "32bit");
  srcs = {
    "x86_64-linux" = fetchurl {
      url = "https://www.dropbox.com/s/0vi87eef3ooh7iy/${mainbin}.tgz";
      sha256 = "0d1cayxr1a4j19bc5a3qp9pg22ggzmd55b6f5av3lc6lvwqqg4w6";
    };
  };

  desktopItem = makeDesktopItem {
    name = "SoulseekQt";
    exec = "soulseekqt";
    icon = "$out/share/soulseekqt/";
    comment = "Official Qt SoulSeek client"; 
    desktopName = "SoulseekQt";
    genericName = "SoulseekQt";
    categories = "Network;";
  };

in stdenv.mkDerivation rec {

  name = "soulseekqt-${version}";
  inherit version;
  src = srcs."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}");

  dontBuild = true;

  buildInputs = [ pythonPackages.binwalk squashfsTools ];

  # avoid usage of appimagetool
  unpackCmd = ''
    export HOME=$(pwd) # workaround for binwalk
    tar xvf $curSrc && binwalk --quiet \
       ${mainbin}.AppImage -D 'squashfs:.squashfs:unsquashfs %e'
    '';

  installPhase = ''
    mkdir -p $out/{bin,share/soulseekqt}
    cd squashfs-root/
    cp -R soulseek.png translations $out/share/soulseekqt
    cp SoulseekQt $out/bin/soulseekqt
  '';

  fixupPhase = ''
    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
             --set-rpath ${libPath} \
             $out/bin/soulseekqt
  '';

  meta = with stdenv.lib; {
    description = "Official Qt SoulSeek client";
    homepage = http://www.soulseekqt.net;
    license = licenses.unfree;
    maintainers = [ maintainers.genesis ];
    platforms = [ "x86_64-linux" ];
  };
}