about summary refs log tree commit diff
path: root/pkgs/games/instead/default.nix
blob: 0d46e187d7b6ef1ede5a698531d28dbf54ef8ab7 (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
{ stdenv, fetchurl, SDL, SDL_ttf, SDL_image, SDL_mixer, pkgconfig, lua, zlib, unzip }:

let
  version = "1.2.2";

  # I took two games at random from http://instead.syscall.ru/games/
  games = [
    (fetchurl {
      url = http://instead-games.googlecode.com/files/instead-apple-day-1.2.zip;
      sha256 = "0d4m554hiqmgl4xl0jp0b3bqjl35879768hqznh9y57y04sygd2a";
    })
    (fetchurl {
      url = http://instead-games.googlecode.com/files/instead-cat-1.3.zip;
      sha256 = "0vmsn7jg2vy5kqqbzad289vk4j3piarj1xpwyz72wgyc3k7djg4v";
    })
    (fetchurl {
      url = http://instead-games.googlecode.com/files/instead-cat_en-1.2.zip;
      sha256 = "0jlm3ssqlka16dm0rg6qfjh6xdh3pv7lj2s4ib4mqwj2vfy0v6sg";
    })
    (fetchurl {
      url = http://instead-games.googlecode.com/files/instead-vinny-0.1.zip;
      sha256 = "15qdbg82zp3a8vz4qxminr0xbzbdpnsciliy2wm3raz4hnadawg1";
    })
    (fetchurl {
      url = http://instead-games.googlecode.com/files/instead-toilet-1.1.zip;
      sha256 = "17mlkr93y77pxhimq0v9f0w78fz8alkxwjwsr8z67p458iw6s1wr";
    })
  ];
in

stdenv.mkDerivation rec {
  name = "instead-" + version;

  src = fetchurl {
    url = "http://instead.googlecode.com/files/instead_${version}.tar.gz";
    sha256 = "178xxqvjl5v1bhjrlf8cqpkw85j25fldf0wn6bgyzicr6fspxb25";
  };

  NIX_LDFLAGS = "-llua -lgcc_s";

  buildInputs = [ SDL SDL_ttf SDL_image SDL_mixer pkgconfig lua zlib unzip ];

  configurePhase = ''
    sed -i -e "s,DATAPATH=.,DATAPATH=$out/share/${name}/," Rules.make
  '';

  inherit games;

  installPhase = ''
    mkdir -p $out/bin $out/share/${name}
    cp sdl-instead $out/bin
    cp -R games languages stead themes $out/share/${name}
    pushd $out/share/${name}/games
    for a in $games; do
      unzip $a
    done
    popd
  '';

  meta = {
    description = "Simple text adventure interpreter for Unix and Windows";
    homepage = http://instead.syscall.ru/;
    license = "GPLv2";
    platforms = with stdenv.lib.platforms; linux;
  };
}