Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 raylib,
6}:
7
8stdenv.mkDerivation {
9 pname = "raylib-games";
10 version = "2022-10-24";
11
12 src = fetchFromGitHub {
13 owner = "raysan5";
14 repo = "raylib-games";
15 rev = "e00d77cf96ba63472e8316ae95a23c624045dcbe";
16 hash = "sha256-N9ip8yFUqXmNMKcvQuOyxDI4yF/w1YaoIh0prvS4Xr4=";
17 };
18
19 buildInputs = [ raylib ];
20
21 configurePhase = ''
22 runHook preConfigure
23 for d in *; do
24 if [ -d $d/src/resources ]; then
25 for f in $d/src/*.c $d/src/*.h; do
26 sed "s|\"resources/|\"$out/resources/$d/|g" -i $f
27 done
28 fi
29 done
30 runHook postConfigure
31 '';
32
33 buildPhase = ''
34 runHook preBuild
35 for d in *; do
36 if [ -f $d/src/Makefile ]; then
37 make -C $d/src
38 fi
39 done
40 runHook postBuild
41 '';
42
43 installPhase = ''
44 runHook preInstall
45 mkdir -p $out/bin $out/resources
46 find . -type f -executable -exec cp {} $out/bin \;
47 for d in *; do
48 if [ -d "$d/src/resources" ]; then
49 cp -ar "$d/src/resources" "$out/resources/$d"
50 fi
51 done
52 runHook postInstall
53 '';
54
55 meta = with lib; {
56 description = "Collection of games made with raylib";
57 homepage = "https://www.raylib.com/games.html";
58 license = licenses.zlib;
59 maintainers = with maintainers; [ ehmry ];
60 inherit (raylib.meta) platforms;
61 };
62}