about summary refs log tree commit diff
path: root/pkgs/by-name/ee/eepers/package.nix
blob: d642252774e91e0b8f255099b1553e82a7309073 (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
76
77
78
79
80
81
{
  lib,
  stdenv,
  fetchFromGitHub,
  gnat,
  raylib,
  alsa-lib,
  wayland,
}:

stdenv.mkDerivation rec {
  pname = "eepers";
  version = "1.3";

  src = fetchFromGitHub {
    owner = "tsoding";
    repo = "eepers";
    rev = "refs/tags/v${version}";
    hash = "sha256-KG7ci327qlTtlN4yV54P8Q34ExFLJfTGMTZxN3RtZbc=";
  };

  postPatch = ''
    substituteInPlace eepers.adb \
      --replace-fail "assets/" "$out/assets/"
  '';

  buildInputs = [
    gnat
    raylib
  ];

  buildPhase = ''
    runHook preBuild

    gnatmake -f -O3 \
      -Wall \
      -Wextra \
      -gnat2012 \
      -o eepers-linux eepers.adb \
      -bargs \
      -largs -lraylib -lm \
      -pthread

    runHook postBuild
  '';

  postFixup = ''
    patchelf $out/bin/eepers \
      --add-needed libwayland-client.so \
      --add-needed libwayland-cursor.so \
      --add-needed libwayland-egl.so \
      --add-needed libasound.so \
      --add-rpath ${
        lib.makeLibraryPath [
          alsa-lib
          wayland
        ]
      }
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    cp ./eepers-linux $out/bin/eepers

    cp -r ./assets $out/

    runHook postInstall
  '';

  meta = {
    description = "Simple Turn-based Game";
    homepage = "https://github.com/tsoding/eepers";
    changelog = "https://github.com/tsoding/eepers/blob/${src.rev}/CHANGELOG.txt";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ GaetanLepage ];
    mainProgram = "eepers";
    platforms = lib.platforms.all;
  };
}