summary refs log tree commit diff
path: root/pkgs/games/endgame-singularity/default.nix
blob: f220a85e0eb654db37edb9a00bdfa206bf57c4f9 (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
{ lib, stdenv
, fetchurl
, fetchFromGitHub
, unzip
, python3
, enableDefaultMusicPack ? true
}:

python3.pkgs.buildPythonApplication rec {
  pname = "endgame-singularity";
  version = "1.00";

  srcs = [
    (fetchFromGitHub {
      owner = "singularity";
      repo = "singularity";
      rev = "v${version}";
      sha256 = "0ndrnxwii8lag6vrjpwpf5n36hhv223bb46d431l9gsigbizv0hl";
    })
  ] ++ lib.optional enableDefaultMusicPack (
    fetchurl {
      url = "http://www.emhsoft.com/singularity/endgame-singularity-music-007.zip";
      sha256 = "0vf2qaf66jh56728pq1zbnw50yckjz6pf6c6qw6dl7vk60kkqnpb";
    }
  );
  sourceRoot = "source";

  nativeBuildInputs = [ unzip ]; # The music is zipped
  propagatedBuildInputs = with python3.pkgs; [ pygame numpy polib ];

  # Add the music
  postInstall = lib.optionalString enableDefaultMusicPack ''
    cp -R "../endgame-singularity-music-007" \
          "$(echo $out/lib/python*/site-packages/singularity)/music"
          # ↑ we cannot glob on [...]/music, it doesn't exist yet
  '';

  meta = {
    homepage = "http://www.emhsoft.com/singularity/";
    description = "A simulation game about strong AI";
    longDescription = ''
      A simulation of a true AI. Go from computer to computer, pursued by the
      entire world. Keep hidden, and you might have a chance
    '';
    license = lib.licenses.gpl2;
    maintainers = with lib.maintainers; [ fgaz ];
  };
}