about summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authorEmery Hemingway <ehmry@posteo.net>2022-10-23 20:18:46 -0500
committerehmry <ehmry@posteo.net>2022-10-31 08:54:48 -0500
commit19d9ac28cc04047b2a7b9ed8a0c509f2d1d3d8d2 (patch)
tree49691bef2022d46d603474ba28de2f4b7896e78e /pkgs/games
parent7aa48a0dd39ac66c850ccc123c3608fca6bca4ee (diff)
raylib-games: init at 2022-10-14
Now we have something to test our Raylib package against.
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/raylib-games/default.nix57
1 files changed, 57 insertions, 0 deletions
diff --git a/pkgs/games/raylib-games/default.nix b/pkgs/games/raylib-games/default.nix
new file mode 100644
index 0000000000000..6cb2b540f4abc
--- /dev/null
+++ b/pkgs/games/raylib-games/default.nix
@@ -0,0 +1,57 @@
+{ lib, stdenv, fetchFromGitHub, raylib }:
+
+stdenv.mkDerivation rec {
+  pname = "raylib-games";
+  version = "2022-10-24";
+
+  src = fetchFromGitHub {
+    owner = "raysan5";
+    repo = pname;
+    rev = "e00d77cf96ba63472e8316ae95a23c624045dcbe";
+    hash = "sha256-N9ip8yFUqXmNMKcvQuOyxDI4yF/w1YaoIh0prvS4Xr4=";
+  };
+
+  buildInputs = [ raylib ];
+
+  configurePhase = ''
+    runHook preConfigure
+    for d in *; do
+      if [ -d $d/src/resources ]; then
+        for f in $d/src/*.c $d/src/*.h; do
+          sed "s|\"resources/|\"$out/resources/$d/|g" -i $f
+        done
+      fi
+    done
+    runHook postConfigure
+  '';
+
+  buildPhase = ''
+    runHook preBuild
+    for d in *; do
+      if [ -f $d/src/Makefile ]; then
+        make -C $d/src
+      fi
+    done
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preBuild
+    mkdir -p $out/bin $out/resources
+    find . -type f -executable -exec cp {} $out/bin \;
+    for d in *; do
+      if [ -d "$d/src/resources" ]; then
+        cp -ar "$d/src/resources" "$out/resources/$d"
+      fi
+    done
+    runHook postBuild
+  '';
+
+  meta = with lib; {
+    description = "A collection of games made with raylib ";
+    homepage = "https://www.raylib.com/games.html";
+    license = licenses.zlib;
+    maintainers = with maintainers; [ ehmry ];
+    inherit (raylib.meta) platforms;
+  };
+}