diff --git a/pkgs/by-name/te/tetrio-desktop/package.nix b/pkgs/by-name/te/tetrio-desktop/package.nix index d7fed29e7dae..274cd2d26957 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 + 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 ]; }; -})) +})