This repository has been archived on 2024-01-28. You can view files and clone it, but cannot push or open issues or pull requests.
pokegb-nix/pokeruby/default.nix

54 lines
1.5 KiB
Nix
Raw Normal View History

2021-08-07 14:08:39 +02:00
{ lib, stdenv, fetchFromGitHub, libpng, agbcc, gcc-arm-embedded, rsync, modern ? false, roms ? null, german ? false }:
let
roms' =
if roms == null
then
(if german
then [ "ruby_de" "ruby_de_rev1" "sapphire_de" "sapphire_de_rev1" ]
else [ "ruby" "ruby_rev1" "ruby_rev2" "sapphire" "sapphire_rev1" "sapphire_rev2" ])
else roms;
in
stdenv.mkDerivation rec {
pname = "pokeruby${lib.optionalString german "-de"}${lib.optionalString modern "-modern"}";
version = "unstable-2021-07-16";
src = fetchFromGitHub {
owner = "pret";
repo = "pokeruby";
rev = "7cc7f95aa646bb38cb4c29e4422df7b6f1ffd81e";
sha256 = "sha256-i4MOcvJQTAoWJRgf0l0oSSFz2MoUzD4+ADmvhldytg4=";
};
nativeBuildInputs = [ gcc-arm-embedded ] ++ lib.optional german rsync;
buildInputs = [ libpng ];
postPatch = ''
ln -s ${agbcc}/tools/agbcc tools/
'';
preBuild = lib.optionalString german ''
bash de_before.sh
'';
makeFlags = [
"TOOLCHAIN=${gcc-arm-embedded}"
"MODERN=${if modern then "1" else "0"}"
] ++ roms';
enableParallelBuilding = true;
installPhase = ''
runHook preInstall
mkdir -p $out
cp poke{${lib.concatStringsSep "," roms'}}${lib.optionalString modern "_modern"}.gba $out
runHook postInstall
'';
meta = with lib; {
description = "ROM built from disassembly of Pokémon Ruby/Sapphire";
homepage = "https://github.com/pret/pokeruby";
license = licenses.unfree;
maintainers = with maintainers; [ sbruder ];
};
}