packages/tetrio: init

This commit is contained in:
LavaDesu 2022-01-05 21:02:35 +07:00
parent bf54c8b48b
commit c110e53871
Signed by: cilly
GPG key ID: 6500251E087653C9
4 changed files with 117 additions and 1 deletions

View file

@ -1,13 +1,15 @@
{
callPackage,
inputs
}: {
}: rec {
discord-tokyonight = callPackage ./discord-tokyonight { inherit inputs; };
discover-overlay = callPackage ./discover { inherit inputs; };
linux-lava = callPackage ./linux-lava { inherit inputs; };
nvim-treesitter-nightly = callPackage ./nvim-treesitter-nightly { inherit inputs; };
packwiz = callPackage ./packwiz { inherit inputs; };
spotify-adblock = callPackage ./spotify-adblock { inherit inputs; };
tetrio-desktop = callPackage ./tetrio/base.nix { };
tetrio-desktop-plus = callPackage ./tetrio/plus.nix { inherit tetrio-desktop; };
tree-sitter-glimmer = callPackage ./tree-sitter-glimmer { inherit inputs; };
tree-sitter-jsonc = callPackage ./tree-sitter-jsonc { inherit inputs; };
wine-discord-ipc-bridge = callPackage ./wine-discord-ipc-bridge { inherit inputs; };

81
packages/tetrio/base.nix Normal file
View file

@ -0,0 +1,81 @@
# Copied from https://github.com/NixOS/nixpkgs/pull/146940
{ stdenv
, lib
, fetchurl
, autoPatchelfHook
, alsa-lib
, cups
, libX11
, libXScrnSaver
, libXtst
, mesa
, nss
, systemd
, wrapGAppsHook
}:
stdenv.mkDerivation rec {
pname = "tetrio-desktop";
version = "8.0.0";
src = fetchurl {
url = "https://web.archive.org/web/20211228025517/https://tetr.io/about/desktop/builds/TETR.IO%20Setup.deb";
name = "${pname}.deb";
sha256 = "1nlblfhrph4cw8rpic9icrs78mzrxyskl7ggyy2i8bk9i07i21xf";
};
nativeBuildInputs = [
alsa-lib
autoPatchelfHook
cups
libX11
libXScrnSaver
libXtst
mesa
nss
wrapGAppsHook
];
dontWrapGApps = true;
libPath = lib.makeLibraryPath [
alsa-lib
cups
libX11
libXScrnSaver
libXtst
mesa
nss
systemd
];
unpackPhase = ''
mkdir -p $TMP/${pname} $out/bin
cp $src $TMP/${pname}.deb
ar vx $TMP/${pname}.deb
tar --no-overwrite-dir -xvf data.tar.xz -C $TMP/${pname}/
'';
installPhase = ''
cp -R $TMP/${pname}/{usr/share,opt} $out/
wrapProgram $out/opt/TETR.IO/${pname} \
--prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/TETR.IO
ln -s $out/opt/TETR.IO/${pname} $out/bin/
substituteInPlace $out/share/applications/${pname}.desktop \
--replace "Exec=\"/opt/TETR.IO/${pname}\"" "Exec=\"$out/opt/TETR.IO/${pname}\""
'';
meta = with lib; {
homepage = "https://tetr.io";
downloadPage = "https://tetr.io/about/desktop/";
description = "TETR.IO desktop client";
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!
'';
platforms = [ "x86_64-linux" ];
license = licenses.unfree;
#maintainers = with maintainers; [ wackbyte ];
};
}

32
packages/tetrio/plus.nix Normal file
View file

@ -0,0 +1,32 @@
{
symlinkJoin,
stdenvNoCC,
tetrio-desktop,
unzip
}:
let
version = "0.23.7";
patchedAsar = stdenvNoCC.mkDerivation {
inherit version;
name = "tetrio-plus";
src = builtins.fetchurl {
url = "https://gitlab.com/UniQMG/tetrio-plus/uploads/e51f2fd7a1370bf4ceeecd371204c2e1/tetrio-plus_0.23.7_app.asar.zip";
sha256 = "03nla54r6s2xhd1ipxl0ffx6q0brby1jlxdx8p2q1nw80dx4gf1l";
};
dontUnpack = true;
nativeBuildInputs = [ unzip ];
buildPhase = ''
mkdir -p $out
unzip $src -d $out
'';
dontInstall = true;
};
in tetrio-desktop.overrideAttrs(old: {
pname = "tetrio-desktop-plus";
version = old.version + "+${version}";
installPhase = old.installPhase + ''
cp ${patchedAsar}/app.asar $out/opt/TETR.IO/resources
'';
})