nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, fetchFromGitHub, cmake, SDL2, libGLU, luajit, curl, curlpp }:
2
3let
4 # Newer versions of sdl-gpu don't work with Riko4 (corrupted graphics),
5 # and this library does not have a proper release version, so let the
6 # derivation for this stay next to the Riko4 derivation for now.
7 sdl-gpu = stdenv.mkDerivation {
8 pname = "sdl-gpu";
9 version = "2018-11-01";
10 src = fetchFromGitHub {
11 owner = "grimfang4";
12 repo = "sdl-gpu";
13 rev = "a4ff1ab02410f154b004c29ec46e07b22890fa1f";
14 sha256 = "1wdwg331s7r4dhq1l8w4dvlqf4iywskpdrscgbwrz9j0c6nqqi3v";
15 };
16 buildInputs = [ SDL2 libGLU ];
17 nativeBuildInputs = [ cmake ];
18
19 meta = with lib; {
20 homepage = "https://github.com/grimfang4/sdl-gpu";
21 description = "A library for high-performance, modern 2D graphics with SDL written in C";
22 license = licenses.mit;
23 maintainers = with maintainers; [ CrazedProgrammer ];
24 };
25 };
26in
27
28stdenv.mkDerivation rec {
29 pname = "riko4";
30 version = "0.1.0";
31 src = fetchFromGitHub {
32 owner = "incinirate";
33 repo = "Riko4";
34 rev = "v${version}";
35 sha256 = "008i9991sn616dji96jfwq6gszrspbx4x7cynxb1cjw66phyy5zp";
36 };
37
38 buildInputs = [ SDL2 luajit sdl-gpu curl curlpp ];
39 nativeBuildInputs = [ cmake ];
40
41 hardeningDisable = [ "fortify" ];
42 cmakeFlags = [ "-DSDL2_gpu_INCLUDE_DIR=\"${sdl-gpu}/include\"" ];
43
44 # Riko4 needs the data/ and scripts/ directories to be in its PWD.
45 installPhase = ''
46 install -Dm0755 riko4 $out/bin/.riko4-unwrapped
47 mkdir -p $out/lib/riko4
48 cp -r ../data $out/lib/riko4
49 cp -r ../scripts $out/lib/riko4
50 cat > $out/bin/riko4 <<EOF
51 #!/bin/sh
52 pushd $out/lib/riko4 > /dev/null
53 exec $out/bin/.riko4-unwrapped "\$@"
54 popd > /dev/null
55 EOF
56 chmod +x $out/bin/riko4
57 '';
58
59 meta = with lib; {
60 homepage = "https://github.com/incinirate/Riko4";
61 description = "Fantasy console for pixel art game development";
62 license = licenses.mit;
63 maintainers = with maintainers; [ CrazedProgrammer ];
64 };
65}