about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2024-04-20 21:00:47 +0200
committerGitHub <noreply@github.com>2024-04-20 21:00:47 +0200
commitc1d22db7c656d281918f553f1b27f3c017fa40bd (patch)
tree616a10090a97647210ea530c9677108d8eaa4888 /pkgs
parent52c9b9d1b1cde669fea26505c3911ccd03e814c5 (diff)
parent96da6f53e02e8ac7fc5136461429a742db5550db (diff)
Merge pull request #300166 from huantianad/tetrio-nixpkgs-electron
tetrio-desktop: use nixpkgs electron
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/by-name/te/tetrio-desktop/package.nix62
1 files changed, 17 insertions, 45 deletions
diff --git a/pkgs/by-name/te/tetrio-desktop/package.nix b/pkgs/by-name/te/tetrio-desktop/package.nix
index d7fed29e7dae7..274cd2d269571 100644
--- a/pkgs/by-name/te/tetrio-desktop/package.nix
+++ b/pkgs/by-name/te/tetrio-desktop/package.nix
@@ -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
-  ];
-
-  dontWrapGApps = true;
-
-  buildInputs = [
-    alsa-lib
-    cups
-    libX11
-    libXScrnSaver
-    libXtst
-    mesa
-    nss
-    gtk3
+    makeWrapper
   ];
 
-  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 ];
   };
-}))
+})