about summary refs log tree commit diff
path: root/nixpkgs/pkgs/games/antsimulator/default.nix
blob: bac481c88f35354250c85f861a7f3b1a2518610d (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
{ lib, stdenv, fetchFromGitHub, cmake, sfml }:

stdenv.mkDerivation rec {
  pname = "antsimulator";
  version = "3.1";

  src = fetchFromGitHub {
    owner = "johnBuffer";
    repo = "AntSimulator";
    rev = "v${version}";
    sha256 = "sha256-1KWoGbdjF8VI4th/ZjAzASgsLEuS3xiwObulzxQAppA=";
  };

  nativeBuildInputs = [ cmake ];
  buildInputs = [ sfml ];

  postPatch = ''
    substituteInPlace src/main.cpp \
      --replace "res/" "$out/opt/antsimulator/"

    substituteInPlace include/simulation/config.hpp \
      --replace "res/" "$out/opt/antsimulator/"

    substituteInPlace include/render/colony_renderer.hpp \
      --replace "res/" "$out/opt/antsimulator/"
  '';

  installPhase = ''
    install -Dm644 -t $out/opt/antsimulator res/*
    install -Dm755 ./AntSimulator $out/bin/antsimulator
  '';

  meta = with lib; {
    homepage = "https://github.com/johnBuffer/AntSimulator";
    description = "Simple Ants simulator";
    license = licenses.free;
    maintainers = with maintainers; [ ivar ];
    platforms = platforms.unix;
  };
}