tetrio-desktop: use nixpkgs electron

This commit is contained in:
huantian 2024-03-29 22:01:29 -07:00
parent cd75d22750
commit 96da6f53e0
No known key found for this signature in database
GPG Key ID: 4A0318E04E555DE5
1 changed files with 17 additions and 45 deletions

View File

@ -2,19 +2,9 @@
, lib
, fetchurl
, dpkg
, autoPatchelfHook
, wrapGAppsHook
, alsa-lib
, cups
, libGL
, libX11
, libXScrnSaver
, libXtst
, mesa
, nss
, gtk3
, libpulseaudio
, systemd
, makeWrapper
, addOpenGLRunpath
, electron
, withTetrioPlus ? false # For backwards compatibility. At the time of writing, the latest released tetrio plus version is not compatible with tetrio desktop.
, tetrio-plus ? false # For backwards compatibility. At the time of writing, the latest released tetrio plus version is not compatible with tetrio desktop.
}:
@ -22,13 +12,6 @@
lib.warnIf (withTetrioPlus != false) "withTetrioPlus: Currently unsupported with tetrio-desktop 9.0.0. Please remove this attribute."
lib.warnIf (tetrio-plus != false) "tetrio-plus: Currently unsupported with tetrio-desktop 9.0.0. Please remove this attribute."
(let
libPath = lib.makeLibraryPath [
libGL
libpulseaudio
systemd
];
in
stdenv.mkDerivation (finalAttrs: {
pname = "tetrio-desktop";
version = "9.0.0";
@ -40,31 +23,17 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
dpkg
autoPatchelfHook
wrapGAppsHook
makeWrapper
];
dontWrapGApps = true;
buildInputs = [
alsa-lib
cups
libX11
libXScrnSaver
libXtst
mesa
nss
gtk3
];
unpackCmd = "dpkg -x $curSrc src";
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -r opt/ usr/share/ $out
ln -s $out/opt/TETR.IO/TETR.IO $out/bin/tetrio
mkdir -p $out
cp -r usr/share/ $out
mkdir -p $out/share/TETR.IO/
cp opt/TETR.IO/resources/app.asar $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"
@ -73,12 +42,14 @@ stdenv.mkDerivation (finalAttrs: {
'';
postFixup = ''
wrapProgram $out/opt/TETR.IO/TETR.IO \
--prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/TETR.IO \
''${gappsWrapperArgs[@]}
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";
@ -88,7 +59,8 @@ stdenv.mkDerivation (finalAttrs: {
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 ];
maintainers = with lib.maintainers; [ wackbyte huantian ];
platforms = [ "x86_64-linux" ];
sourceProvenance = [ lib.sourceTypes.binaryBytecode ];
};
}))
})