blob: 4d02efc2aa4f95c08b5fb47098b9ceae4edd1360 (
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
|
{ stdenv
, lib
, fetchzip
, dpkg
, makeWrapper
, callPackage
, addOpenGLRunpath
, electron
, withTetrioPlus ? false
, tetrio-plus ? null
}:
stdenv.mkDerivation (finalAttrs: {
pname = "tetrio-desktop";
version = "9.0.0";
src = fetchzip {
url = "https://tetr.io/about/desktop/builds/${lib.versions.major finalAttrs.version}/TETR.IO%20Setup.deb";
hash = "sha256-TgegFy+sHjv0ILaiLO1ghyUhKXoj8v43ACJOJhKyI0c=";
nativeBuildInputs = [ dpkg ];
};
nativeBuildInputs = [
makeWrapper
];
installPhase =
let
tetrio-plus' =
if tetrio-plus == null
then callPackage ./tetrio-plus.nix { tetrio-src = finalAttrs.src; }
else tetrio-plus;
asarPath =
if withTetrioPlus
then "${tetrio-plus'}/app.asar"
else "opt/TETR.IO/resources/app.asar";
in
''
runHook preInstall
mkdir -p $out
cp -r usr/share/ $out
mkdir -p $out/share/TETR.IO/
cp ${asarPath} $out/share/TETR.IO/app.asar
substituteInPlace $out/share/applications/TETR.IO.desktop \
--replace-fail "Exec=/opt/TETR.IO/TETR.IO" "Exec=$out/bin/tetrio"
runHook postInstall
'';
postFixup = ''
makeShellWrapper '${lib.getExe electron}' $out/bin/tetrio \
--prefix LD_LIBRARY_PATH : ${addOpenGLRunpath.driverLink}/lib \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--add-flags $out/share/TETR.IO/app.asar
'';
meta = {
changelog = "https://tetr.io/about/desktop/history/";
description = "TETR.IO desktop client";
downloadPage = "https://tetr.io/about/desktop/";
homepage = "https://tetr.io";
license = lib.licenses.unfree;
longDescription = ''
TETR.IO is a modern yet familiar online stacker.
Play against friends and foes all over the world, or claim a spot on the leaderboards - the stacker future is yours!
'';
mainProgram = "tetrio";
maintainers = with lib.maintainers; [ wackbyte huantian ];
platforms = [ "x86_64-linux" ];
sourceProvenance = [ lib.sourceTypes.binaryBytecode ];
};
})
|