nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 80 lines 2.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchhg, 5 pkg-config, 6 makeBinaryWrapper, 7 SDL2, 8 glew, 9 gtk3, 10 testers, 11}: 12 13stdenv.mkDerivation (finalAttrs: { 14 pname = "blastem"; 15 version = "0.6.2-unstable-2024-08-14"; 16 17 src = fetchhg { 18 url = "https://www.retrodev.com/repos/blastem"; 19 rev = "aa888682faa0"; 20 hash = "sha256-0xw9O0o1pkJiXHyZer4nMJeLlRXS3Z4YYoLgfkrz3Yo="; 21 }; 22 23 # will probably be fixed in https://github.com/NixOS/nixpkgs/pull/302481 24 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' 25 substituteInPlace Makefile \ 26 --replace-fail "-flto" "" 27 ''; 28 29 nativeBuildInputs = [ 30 pkg-config 31 makeBinaryWrapper 32 ]; 33 34 buildInputs = [ 35 gtk3 36 SDL2 37 glew 38 ]; 39 40 # Note: menu.bin cannot be generated yet, because it would 41 # need the `vasmm68k_mot` executable (part of vbcc for amigaos68k 42 # Luckily, menu.bin doesn't need to be present for the emulator to function 43 44 makeFlags = [ "HOST_ZLIB=1" ]; 45 46 env.NIX_CFLAGS_COMPILE = "-I${lib.getDev SDL2}/include/SDL2"; 47 48 installPhase = '' 49 runHook preInstall 50 51 # not sure if any executable other than blastem is really needed here 52 install -Dm755 blastem dis zdis termhelper -t $out/share/blastem 53 install -Dm644 gamecontrollerdb.txt default.cfg rom.db -t $out/share/blastem 54 cp -r shaders $out/share/blastem/shaders 55 56 # wrapping instead of sym-linking makes sure argv0 stays at the original location 57 makeWrapper $out/share/blastem/blastem $out/bin/blastem 58 59 runHook postInstall 60 ''; 61 62 passthru.tests.version = testers.testVersion { 63 package = finalAttrs.finalPackage; 64 command = "blastem -v"; 65 version = "0.6.3-pre"; # remove line when moving to a stable version 66 }; 67 68 meta = { 69 description = "Fast and accurate Genesis emulator"; 70 homepage = "https://www.retrodev.com/blastem/"; 71 license = lib.licenses.gpl3Plus; 72 mainProgram = "blastem"; 73 maintainers = with lib.maintainers; [ tomasajt ]; 74 platforms = [ 75 "i686-linux" 76 "x86_64-linux" 77 "x86_64-darwin" 78 ]; 79 }; 80})