summary refs log tree commit diff
path: root/pkgs/games/tcl2048/default.nix
blob: d1517a2ec6198f164f086c0cc1cc61a74750a168 (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
{ stdenv, fetchurl, tcl, tcllib }:

stdenv.mkDerivation {
  name = "tcl2048-0.3.1";

  src = fetchurl {
    url = https://raw.githubusercontent.com/dbohdan/2048-tcl/v0.3.1/2048.tcl;
    sha256 = "44e325328784c4e91cecc0a9cc00e32d733da713adf2fad1c081542f38af3361";
  };

  phases = "installPhase";

  installPhase = ''
    mkdir -pv $out/bin
    cp $src $out/2048.tcl
    cat > $out/bin/2048 << EOF
    #!${stdenv.shell}

    # wrapper for tcl2048
    export TCLLIBPATH="${tcllib}/lib/tcllib${tcllib.version}"
    ${tcl}/bin/tclsh $out/2048.tcl
    EOF

    chmod +x $out/bin/2048
  '';

  meta = {
    homepage = https://github.com/dbohdan/2048-tcl;
    description = "The game of 2048 implemented in Tcl";
    license = stdenv.lib.licenses.mit;
    platforms = stdenv.lib.platforms.all;
    maintainers = with stdenv.lib.maintainers; [ dbohdan ];
  };
}