about summary refs log tree commit diff
path: root/pkgs/games/openloco/default.nix
blob: caa286c7ef62c0b446251c54ae257ed77dae4484 (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
{ lib
, stdenv
, fetchFromGitHub
, SDL2
, cmake
, libpng
, libzip
, openal
, pkg-config
, yaml-cpp
, fmt
}:

stdenv.mkDerivation rec {
  pname = "openloco";
  version = "24.04";

  src = fetchFromGitHub {
    owner = "OpenLoco";
    repo = "OpenLoco";
    rev = "v${version}";
    hash = "sha256-LyA1Wl2xto05DUp3kuWEQo7Hbk8PAy990PC7bLeBFto=";
  };

  # the upstream build process determines the version tag from git; since we
  # are not using a git checkout, we patch it manually
  postPatch = ''
    sed -i '/#define NAME "OpenLoco"/a#define OPENLOCO_VERSION_TAG "${version}"' src/OpenLoco/src/Version.cpp
  '';

  NIX_CFLAGS_COMPILE = "-Wno-error=null-dereference";

  cmakeFlags = [
    "-DOPENLOCO_BUILD_TESTS=NO"
  ];

  nativeBuildInputs = [
    cmake
    pkg-config
  ];
  buildInputs = [
    SDL2
    libpng
    libzip
    openal
    yaml-cpp
    fmt
  ];

  meta = {
    description = "Open source re-implementation of Chris Sawyer's Locomotion";
    homepage = "https://github.com/OpenLoco/OpenLoco";
    license = lib.licenses.mit;
    platforms = lib.platforms.linux;
    maintainers = with lib.maintainers; [ icewind1991 ];
  };
}