@@ -0,0 +1,39 @@
1+{ fetchurl, stdenv, dpkg, makeWrapper, fontconfig, freetype, openssl, xorg, xkeyboard_config }:
2+
3+assert stdenv.system == "x86_64-linux";
4+
5+stdenv.mkDerivation rec {
6+ version = "8.1";
7+ name = "minergate-${version}";
8+ src = fetchurl {
9+ url = "https://minergate.com/download/ubuntu";
10+ sha256 = "1dbbbb8e0735cde239fca9e82c096dcc882f6cecda20bba7c14720a614c16e13";
11+ };
12+
13+ nativeBuildInputs = [ dpkg makeWrapper ];
14+
15+ phases = [ "installPhase" ];
16+
17+ installPhase = ''
18+ dpkg-deb -x $src $out
19+ pgm=$out/opt/minergate/minergate
20+
21+ interpreter=${stdenv.glibc}/lib/ld-linux-x86-64.so.2
22+ patchelf --set-interpreter "$interpreter" $pgm
23+
24+ wrapProgram $pgm --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ fontconfig freetype openssl stdenv.cc.cc xorg.libX11 xorg.libxcb ]} --prefix "QT_XKB_CONFIG_ROOT" ":" "${xkeyboard_config}/share/X11/xkb"
25+
26+ rm $out/usr/bin/minergate
27+ mkdir -p $out/bin
28+ ln -s $out/opt/minergate/minergate $out/bin
29+ '';
30+
31+ meta = with stdenv.lib; {
32+ description = "Minergate CPU/GPU mining software";
33+ homepage = https://www.minergate.com/;
34+ license = licenses.unfree;
35+ maintainers = with maintainers; [ bfortz ];
36+ platforms = [ "x86_64-linux" ];
37+};
38+}
39+