mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
62 lines
1.4 KiB
Nix
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;
|
|
};
|
|
}
|