@@ -0,0 +1,85 @@
1+{ stdenv
2+, lib
3+, fetchurl
4+, autoPatchelfHook
5+, alsa-lib
6+, cups
7+, libX11
8+, libXScrnSaver
9+, libXtst
10+, mesa
11+, nss
12+, systemd
13+, wrapGAppsHook
14+}:
15+
16+stdenv.mkDerivation rec {
17+ pname = "tetrio-desktop";
18+ version = "8.0.0";
19+
20+ src = fetchurl {
21+ url = "https://web.archive.org/web/20211130172544/https://tetr.io/about/desktop/builds/TETR.IO%20Setup.deb";
22+ name = "tetrio-desktop.deb";
23+ sha256 = "1nlblfhrph4cw8rpic9icrs78mzrxyskl7ggyy2i8bk9i07i21xf";
24+ };
25+
26+ nativeBuildInputs = [
27+ autoPatchelfHook
28+ wrapGAppsHook
29+ ];
30+
31+ buildInputs = [
32+ alsa-lib
33+ cups
34+ libX11
35+ libXScrnSaver
36+ libXtst
37+ mesa
38+ nss
39+ ];
40+
41+ dontWrapGApps = true;
42+
43+ libPath = lib.makeLibraryPath [
44+ alsa-lib
45+ cups
46+ libX11
47+ libXScrnSaver
48+ libXtst
49+ mesa
50+ nss
51+ systemd
52+ ];
53+
54+ unpackPhase = ''
55+ mkdir -p $TMP/tetrio-desktop $out/bin
56+ cp $src $TMP/tetrio-desktop.deb
57+ ar vx $TMP/tetrio-desktop.deb
58+ tar --no-overwrite-dir -xvf data.tar.xz -C $TMP/tetrio-desktop/
59+ '';
60+
61+ installPhase = ''
62+ cp -R $TMP/tetrio-desktop/{usr/share,opt} $out/
63+
64+ wrapProgram $out/opt/TETR.IO/tetrio-desktop \
65+ --prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/TETR.IO
66+
67+ ln -s $out/opt/TETR.IO/tetrio-desktop $out/bin/
68+
69+ substituteInPlace $out/share/applications/tetrio-desktop.desktop \
70+ --replace "Exec=\"/opt/TETR.IO/tetrio-desktop\"" "Exec=\"$out/opt/TETR.IO/tetrio-desktop\""
71+ '';
72+
73+ meta = with lib; {
74+ homepage = "https://tetr.io";
75+ downloadPage = "https://tetr.io/about/desktop/";
76+ description = "TETR.IO desktop client";
77+ longDescription = ''
78+ TETR.IO is a modern yet familiar online stacker.
79+ Play against friends and foes all over the world, or claim a spot on the leaderboards - the stacker future is yours!
80+ '';
81+ platforms = [ "x86_64-linux" ];
82+ license = licenses.unfree;
83+ maintainers = with maintainers; [ wackbyte ];
84+ };
85+}