Merge pull request #300166 from huantianad/tetrio-nixpkgs-electron

tetrio-desktop: use nixpkgs electron
This commit is contained in:
Sandro 2024-04-20 21:00:47 +02:00 committed by GitHub
commit c1d22db7c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,19 +2,9 @@
, lib , lib
, fetchurl , fetchurl
, dpkg , dpkg
, autoPatchelfHook , makeWrapper
, wrapGAppsHook , addOpenGLRunpath
, alsa-lib , electron
, cups
, libGL
, libX11
, libXScrnSaver
, libXtst
, mesa
, nss
, gtk3
, libpulseaudio
, systemd
, withTetrioPlus ? false # For backwards compatibility. At the time of writing, the latest released tetrio plus version is not compatible with tetrio desktop. , 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. , 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 (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." 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: { stdenv.mkDerivation (finalAttrs: {
pname = "tetrio-desktop"; pname = "tetrio-desktop";
version = "9.0.0"; version = "9.0.0";
@ -40,31 +23,17 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [ nativeBuildInputs = [
dpkg dpkg
autoPatchelfHook makeWrapper
wrapGAppsHook
]; ];
dontWrapGApps = true;
buildInputs = [
alsa-lib
cups
libX11
libXScrnSaver
libXtst
mesa
nss
gtk3
];
unpackCmd = "dpkg -x $curSrc src";
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p $out/bin mkdir -p $out
cp -r opt/ usr/share/ $out cp -r usr/share/ $out
ln -s $out/opt/TETR.IO/TETR.IO $out/bin/tetrio
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 \ substituteInPlace $out/share/applications/TETR.IO.desktop \
--replace-fail "Exec=/opt/TETR.IO/TETR.IO" "Exec=$out/bin/tetrio" --replace-fail "Exec=/opt/TETR.IO/TETR.IO" "Exec=$out/bin/tetrio"
@ -73,12 +42,14 @@ stdenv.mkDerivation (finalAttrs: {
''; '';
postFixup = '' postFixup = ''
wrapProgram $out/opt/TETR.IO/TETR.IO \ makeShellWrapper '${lib.getExe electron}' $out/bin/tetrio \
--prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/TETR.IO \ --prefix LD_LIBRARY_PATH : ${addOpenGLRunpath.driverLink}/lib \
''${gappsWrapperArgs[@]} --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--add-flags $out/share/TETR.IO/app.asar
''; '';
meta = { meta = {
changelog = "https://tetr.io/about/desktop/history/";
description = "TETR.IO desktop client"; description = "TETR.IO desktop client";
downloadPage = "https://tetr.io/about/desktop/"; downloadPage = "https://tetr.io/about/desktop/";
homepage = "https://tetr.io"; 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! Play against friends and foes all over the world, or claim a spot on the leaderboards - the stacker future is yours!
''; '';
mainProgram = "tetrio"; mainProgram = "tetrio";
maintainers = with lib.maintainers; [ wackbyte ]; maintainers = with lib.maintainers; [ wackbyte huantian ];
platforms = [ "x86_64-linux" ]; platforms = [ "x86_64-linux" ];
sourceProvenance = [ lib.sourceTypes.binaryBytecode ];
}; };
})) })