nixpkgs/pkgs/by-name/ra/raylib-games/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

62 lines
1.4 KiB
Nix

{ lib, stdenv, fetchFromGitHub, raylib, darwin }:
let
inherit (darwin.apple_sdk.frameworks) Cocoa;
in
stdenv.mkDerivation rec {
pname = "raylib-games";
version = "2022-10-24";
src = fetchFromGitHub {
owner = "raysan5";
repo = pname;
rev = "e00d77cf96ba63472e8316ae95a23c624045dcbe";
hash = "sha256-N9ip8yFUqXmNMKcvQuOyxDI4yF/w1YaoIh0prvS4Xr4=";
};
buildInputs = [ raylib ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ Cocoa ];
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 = "Collection of games made with raylib";
homepage = "https://www.raylib.com/games.html";
license = licenses.zlib;
maintainers = with maintainers; [ ehmry ];
inherit (raylib.meta) platforms;
};
}