summary refs log tree commit diff
path: root/default.nix
blob: 2c3982892182eaffdcbb5e15110d806934ed8abb (plain)
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
{ lib, clangStdenv, meson, ninja, pkg-config, lld, glew, glfw, Cocoa, OpenGL, libX11, libXau, libXdmcp }:

let
  stdenv = clangStdenv;
in
stdenv.mkDerivation {
  pname = "meowcraft";
  version = "0.0.1";

  src = ./.;

  nativeBuildInputs = [ meson ninja pkg-config lld ];
  buildInputs = [ glew glfw ]
    ++ lib.optionals stdenv.isDarwin [ Cocoa OpenGL ]
    # TODO: Wayland support.
    # NOTE: Also, even without Wayland, do we really need to link against libXau and
    # libXdmcp of all things??
    ++ lib.optionals stdenv.isLinux [ libX11 libXau libXdmcp ];

  mesonFlags = [
    "--buildtype=release"
    "--prefix=${placeholder "out"}"
  ];

  # FIXME: Currently the built binary on darwin can not be run outside
  # of the nix store, because of it's dependencies on the nix libc++ and libc++abi dylibs.

  meta = with lib; {
    description = "a dumb minecraft in c++ and opengl.";
    homepage = "https://git.rnrd.eu/meowcraft";
    license = licenses.free; # TODO: Choose a specific license.
    platforms = [ "x86_64-linux" "x86_64-darwin" ];
    mainProgram = "meowcraft";
  };
}