update tetrio myself

This commit is contained in:
Kopatz
2024-03-26 10:50:50 +01:00
parent 3c20bf7d3e
commit 4c13ebb225
6 changed files with 156 additions and 13 deletions

View File

@@ -31,21 +31,18 @@
nix-colors, nix-colors,
}@inputs: }@inputs:
let let
inherit (self) outputs;
system = "x86_64-linux"; system = "x86_64-linux";
overlay-unstable = final: prev: {
unstable = import nixpkgs-unstable {
inherit system;
config.allowUnfree = true;
};
};
in { in {
overlays = import ./overlays.nix {inherit inputs;};
nixosConfigurations.server = nixpkgs.lib.nixosSystem { nixosConfigurations.server = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
modules = [ modules = [
### User specific ### ### User specific ###
./users/anon ./users/anon
### System sepecific ### ### System sepecific ###
({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; }) ({ config, outputs, ... }: { nixpkgs.overlays = with outputs.overlays; [additions modifications unstable-packages]; })
./systems/server/configuration.nix ./systems/server/configuration.nix
### Modules ### ### Modules ###
./modules/cli-tools.nix ./modules/cli-tools.nix
@@ -83,7 +80,7 @@
## Custom variables (e.g. ip, interface, etc) ## Custom variables (e.g. ip, interface, etc)
vars = import ./systems/userdata-default.nix // import ./systems/server/userdata.nix; vars = import ./systems/userdata-default.nix // import ./systems/server/userdata.nix;
pkgsVersion = nixpkgs; pkgsVersion = nixpkgs;
inherit inputs ; inherit inputs outputs;
}; };
}; };
nixosConfigurations."kop-pc" = nixpkgs-unstable.lib.nixosSystem { nixosConfigurations."kop-pc" = nixpkgs-unstable.lib.nixosSystem {
@@ -91,7 +88,7 @@
specialArgs = { specialArgs = {
vars = import ./systems/userdata-default.nix // import ./systems/pc/userdata.nix; vars = import ./systems/userdata-default.nix // import ./systems/pc/userdata.nix;
pkgsVersion = nixpkgs-unstable; pkgsVersion = nixpkgs-unstable;
inherit inputs ; inherit inputs outputs;
}; };
modules = [ modules = [
### User specific ### ### User specific ###
@@ -123,7 +120,7 @@
./modules/docker.nix ./modules/docker.nix
./modules/nftables.nix ./modules/nftables.nix
./modules/noise-supression.nix ./modules/noise-supression.nix
({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; }) ({ config, pkgs, ... }: { nixpkgs.overlays = with outputs.overlays; [additions modifications unstable-packages]; })
./modules/wooting.nix ./modules/wooting.nix
./modules/wireshark.nix ./modules/wireshark.nix
./modules/tmpfs.nix ./modules/tmpfs.nix
@@ -145,7 +142,7 @@
modules = [ modules = [
### User specific ### ### User specific ###
./users/kopatz ./users/kopatz
({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; }) ({ config, outputs, ... }: { nixpkgs.overlays = with outputs.overlays; [additions modifications unstable-packages]; })
./modules/graphical/hyprland.nix ./modules/graphical/hyprland.nix
./modules/graphical/emulators.nix ./modules/graphical/emulators.nix
./modules/graphical/gamemode.nix ./modules/graphical/gamemode.nix
@@ -187,7 +184,7 @@
./users/anon ./users/anon
./modules/nix/settings.nix ./modules/nix/settings.nix
./modules/cli-tools.nix ./modules/cli-tools.nix
({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; }) ({ config, outputs, ... }: { nixpkgs.overlays = with outputs.overlays; [additions modifications unstable-packages]; })
./systems/wsl/configuration.nix ./systems/wsl/configuration.nix
nixos-wsl.nixosModules.wsl nixos-wsl.nixosModules.wsl
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager

View File

@@ -4,7 +4,7 @@ let
screenshot = pkgs.writeShellScriptBin "screenshot.sh" '' screenshot = pkgs.writeShellScriptBin "screenshot.sh" ''
${pkgs.scrot}/bin/scrot -fs - | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png -i ${pkgs.scrot}/bin/scrot -fs - | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png -i
''; '';
tetrioPlus = pkgs.unstable.tetrio-desktop.overrideAttrs (old: { tetrioPlus = pkgs.tetrio.overrideAttrs (old: {
withTetrioPlus = true; withTetrioPlus = true;
}); });
in in

23
overlays.nix Normal file
View File

@@ -0,0 +1,23 @@
# This file defines overlays
{inputs, ...}: {
# This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ./pkgs {pkgs = final;};
# This one contains whatever you want to overlay
# You can change versions, add patches, set compilation flags, anything really.
# https://nixos.wiki/wiki/Overlays
modifications = final: prev: {
# example = prev.example.overrideAttrs (oldAttrs: rec {
# ...
# });
};
# When applied, the unstable nixpkgs set (declared in the flake inputs) will
# be accessible through 'pkgs.unstable'
unstable-packages = final: _prev: {
unstable = import inputs.nixpkgs-unstable {
system = final.system;
config.allowUnfree = true;
};
};
}

3
pkgs/default.nix Normal file
View File

@@ -0,0 +1,3 @@
{pkgs, ...}: {
tetrio = pkgs.callPackage ./tetrio-desktop/package.nix { };
}

View File

@@ -0,0 +1,94 @@
{ stdenv
, lib
, fetchurl
, dpkg
, autoPatchelfHook
, wrapGAppsHook
, alsa-lib
, cups
, libGL
, libX11
, libXScrnSaver
, libXtst
, mesa
, nss
, gtk3
, libpulseaudio
, systemd
, callPackage
, tetrio-plus ? callPackage ./tetrio-plus.nix { }
, ...
}:
let
libPath = lib.makeLibraryPath [
libGL
libpulseaudio
systemd
];
in
stdenv.mkDerivation (finalAttrs: {
pname = "tetrio-desktop";
version = "9.0.0";
src = fetchurl {
url = "https://tetr.io/about/desktop/builds/${lib.versions.major finalAttrs.version}/TETR.IO%20Setup.deb";
hash = "sha256-UriLwMB8D+/T32H4rPbkJAy/F/FFhNpd++0AR1lwEfs=";
};
nativeBuildInputs = [
dpkg
autoPatchelfHook
wrapGAppsHook
];
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
substituteInPlace $out/share/applications/TETR.IO.desktop \
--replace-fail "Exec=/opt/TETR.IO/TETR.IO" "Exec=$out/bin/tetrio"
runHook postInstall
'';
postFixup = ''
wrapProgram $out/opt/TETR.IO/TETR.IO \
--prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/TETR.IO \
''${gappsWrapperArgs[@]}
'';
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" ];
};
})

View File

@@ -0,0 +1,26 @@
{ lib, stdenv, fetchzip }:
stdenv.mkDerivation rec {
pname = "tetrio-plus";
version = "0.25.3";
src = fetchzip {
url = "https://gitlab.com/UniQMG/tetrio-plus/-/jobs/6465395934/artifacts/raw/app.asar.zip";
hash = "sha256-24AD63YEypK7XUW6QnqJt56cUExIMrA2WgDi8jS5IFE=";
};
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" ];
};
}