about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPol Dellaiera <pol.dellaiera@protonmail.com>2024-03-26 07:50:40 +0100
committerPol Dellaiera <pol.dellaiera@protonmail.com>2024-03-26 19:42:25 +0100
commitdbb6796cd4a8e6df5d9da30853e920fe0528ae9a (patch)
treee4f98d0985e0358f296b49d8eb0131ef270b4df5
parent9c141d5fb9b2df45a25bd6b9aead99a78f98f322 (diff)
downloadnixlib-dbb6796cd4a8e6df5d9da30853e920fe0528ae9a.tar
nixlib-dbb6796cd4a8e6df5d9da30853e920fe0528ae9a.tar.gz
nixlib-dbb6796cd4a8e6df5d9da30853e920fe0528ae9a.tar.bz2
nixlib-dbb6796cd4a8e6df5d9da30853e920fe0528ae9a.tar.lz
nixlib-dbb6796cd4a8e6df5d9da30853e920fe0528ae9a.tar.xz
nixlib-dbb6796cd4a8e6df5d9da30853e920fe0528ae9a.tar.zst
nixlib-dbb6796cd4a8e6df5d9da30853e920fe0528ae9a.zip
tetrio-desktop: move to `pkgs/by-name`
-rw-r--r--pkgs/by-name/te/tetrio-desktop/package.nix (renamed from pkgs/games/tetrio-desktop/default.nix)54
-rw-r--r--pkgs/games/tetrio-desktop/tetrio-plus.nix27
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 25 insertions, 58 deletions
diff --git a/pkgs/games/tetrio-desktop/default.nix b/pkgs/by-name/te/tetrio-desktop/package.nix
index 97d73cddbb07..d7fed29e7dae 100644
--- a/pkgs/games/tetrio-desktop/default.nix
+++ b/pkgs/by-name/te/tetrio-desktop/package.nix
@@ -15,19 +15,27 @@
 , gtk3
 , libpulseaudio
 , systemd
-, callPackage
-, withTetrioPlus ? false
-, tetrio-plus ? callPackage ./tetrio-plus.nix { }
+, 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.
 }:
 
-stdenv.mkDerivation rec {
+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";
 
   src = fetchurl {
-    url = "https://web.archive.org/web/20240309215118if_/https://tetr.io/about/desktop/builds/9/TETR.IO%20Setup.deb";
-    name = "tetrio-desktop.deb";
-    sha256 = "UriLwMB8D+/T32H4rPbkJAy/F/FFhNpd++0AR1lwEfs=";
+    url = "https://tetr.io/about/desktop/builds/${lib.versions.major finalAttrs.version}/TETR.IO%20Setup.deb";
+    hash = "sha256-UriLwMB8D+/T32H4rPbkJAy/F/FFhNpd++0AR1lwEfs=";
   };
 
   nativeBuildInputs = [
@@ -49,50 +57,38 @@ stdenv.mkDerivation rec {
     gtk3
   ];
 
-  libPath = lib.makeLibraryPath [
-    libGL
-    libpulseaudio
-    systemd
-  ];
-
   unpackCmd = "dpkg -x $curSrc src";
 
   installPhase = ''
     runHook preInstall
 
-    mkdir $out
+    mkdir -p $out/bin
     cp -r opt/ usr/share/ $out
-
-    mkdir $out/bin
-    ln -s $out/opt/TETR.IO/TETR.IO $out/bin/
+    ln -s $out/opt/TETR.IO/TETR.IO $out/bin/tetrio
 
     substituteInPlace $out/share/applications/TETR.IO.desktop \
-      --replace-fail "Exec=/opt/TETR.IO/TETR.IO" "Exec=\"$out/opt/TETR.IO/TETR.IO\""
+      --replace-fail "Exec=/opt/TETR.IO/TETR.IO" "Exec=$out/bin/tetrio"
 
     runHook postInstall
   '';
 
-  postInstall = lib.strings.optionalString withTetrioPlus ''
-    cp ${tetrio-plus} $out/opt/TETR.IO/resources/app.asar
-  '';
-
   postFixup = ''
     wrapProgram $out/opt/TETR.IO/TETR.IO \
       --prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/TETR.IO \
       ''${gappsWrapperArgs[@]}
   '';
 
-  meta = with lib; {
-    homepage = "https://tetr.io";
-    downloadPage = "https://tetr.io/about/desktop/";
+  meta = {
     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 ];
     platforms = [ "x86_64-linux" ];
-    license = licenses.unfree;
-    maintainers = with maintainers; [ wackbyte ];
-    mainProgram = "TETR.IO";
   };
-}
+}))
diff --git a/pkgs/games/tetrio-desktop/tetrio-plus.nix b/pkgs/games/tetrio-desktop/tetrio-plus.nix
deleted file mode 100644
index 64f5dd5d85cc..000000000000
--- a/pkgs/games/tetrio-desktop/tetrio-plus.nix
+++ /dev/null
@@ -1,27 +0,0 @@
-{ lib, stdenv, fetchzip }:
-
-stdenv.mkDerivation rec {
-  pname = "tetrio-plus";
-  version = "0.25.3";
-
-  src = fetchzip {
-    url = "https://gitlab.com/UniQMG/tetrio-plus/uploads/684477053451cd0819e2c84e145966eb/tetrio-plus_0.25.3_app.asar.zip";
-    sha256 = "sha256-GQgt4GZNeKx/uzmVsuKppW2zg8AAiGqsk2JYJIkqfVE=";
-  };
-
-  installPhase = ''
-    runHook preInstall
-
-    install app.asar $out
-
-    runHook postInstall
-  '';
-
-  meta = with lib; {
-    description = "TETR.IO customization toolkit";
-    homepage = "https://gitlab.com/UniQMG/tetrio-plus";
-    license = licenses.mit;
-    maintainers = with maintainers; [ huantian ];
-    platforms = [ "x86_64-linux" ];
-  };
-}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 551c258ef4ae..0ee161dcca62 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -37577,8 +37577,6 @@ with pkgs;
 
   portmod = callPackage ../games/portmod { };
 
-  tetrio-desktop = callPackage ../games/tetrio-desktop { };
-
   tr-patcher = callPackage ../games/tr-patcher { };
 
   tes3cmd = callPackage ../games/tes3cmd { };