about summary refs log tree commit diff
path: root/pkgs/by-name/te/techmino/package.nix
blob: c0467e0e500957b4396fd337f7c5026f3eb16c51 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{ lib
, stdenv
, fetchurl
, callPackage
, makeWrapper
, makeDesktopItem
, love
, luajit
, libcoldclear ? callPackage ./libcoldclear.nix { }
, ccloader ? callPackage ./ccloader.nix { inherit libcoldclear luajit; }
}:

let
  pname = "techmino";
  description = "A modern Tetris clone with many features";

  desktopItem = makeDesktopItem {
    name = pname;
    exec = "techmino";
    icon = fetchurl {
      name = "techmino.png";
      url = "https://github.com/26F-Studio/Techmino/assets/9590981/95981af1-f39a-47d9-bd99-a78ab767c08f";
      hash = "sha256-+j+8m2vwaWgHYSFL6urvTcB0vA+PCZ+FYJ22CNXfcSc=";
    };
    comment = description;
    desktopName = "Techmino";
    genericName = "Tetris Clone";
    categories = [ "Game" ];
  };
in

stdenv.mkDerivation rec {
  inherit pname;
  version = "0.17.16";

  src = fetchurl {
    url = "https://github.com/26F-Studio/Techmino/releases/download/v${version}/Techmino_Bare.love";
    hash = "sha256-IgeVsVS5FLBgoZkJiyMFC1t24HZ/fukE5R0p2YbETTA=";
  };

  nativeBuildInputs = [ makeWrapper ];
  buildInputs = [ love ccloader ];

  dontUnpack = true;

  installPhase = ''
    runHook preInstall

    mkdir -p $out/share/games/lovegames
    cp $src $out/share/games/lovegames/techmino.love

    mkdir -p $out/bin
    makeWrapper ${love}/bin/love $out/bin/techmino \
      --add-flags $out/share/games/lovegames/techmino.love \
      --suffix LUA_CPATH : ${ccloader}/lib/lua/${luajit.luaversion}/CCLoader.so

    mkdir -p $out/share/applications
    ln -s ${desktopItem}/share/applications/* $out/share/applications/

    runHook postInstall
  '';

  passthru = {
    inherit ccloader libcoldclear;
  };

  meta = with lib; {
    inherit description;
    downloadPage = "https://github.com/26F-Studio/Techmino/releases";
    homepage = "https://github.com/26F-Studio/Techmino/";
    license = licenses.lgpl3;
    mainProgram = "techmino";
    maintainers = with maintainers; [ chayleaf ];
  };
}