mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-04 14:00:04 +00:00
To reproduce:
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: nix-x86_64-darwin
language: nix
rule:
any:
- pattern: "\"x86_64-darwin\""
kind: list_expression > string_expression
- pattern:
context: "{ \"x86_64-darwin\" = $EXPR; }"
selector: binding
- pattern:
context: "{ x86_64-darwin = $EXPR; }"
selector: binding
fix:
template: ""
' pkgs
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: json-first-x86_64-darwin
language: json
rule:
kind: object > pair:nth-child(1)
has:
pattern: "\"x86_64-darwin\""
field: key
fix:
template: ""
expandEnd: { regex: "," }
' pkgs
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: json-x86_64-darwin
language: json
rule:
kind: object > pair
has:
pattern: "\"x86_64-darwin\""
field: key
fix:
template: ""
expandStart: { regex: "," }
' pkgs
$ git restore pkgs/by-name/om/omnix/package.nix
$ git diff --name-only -z \
| nix shell nixpkgs/3b32825de172d0bc85664f495edb096b10862524#gnused \
-c xargs -0 sed -i '/^$/N; /^\n\? \+$/d'
$ treefmt
80 lines
2.0 KiB
Nix
80 lines
2.0 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchhg,
|
|
pkg-config,
|
|
makeBinaryWrapper,
|
|
SDL2,
|
|
glew,
|
|
gtk3,
|
|
testers,
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "blastem";
|
|
version = "0.6.2-unstable-2024-08-14";
|
|
|
|
src = fetchhg {
|
|
url = "https://www.retrodev.com/repos/blastem";
|
|
rev = "aa888682faa0";
|
|
hash = "sha256-0xw9O0o1pkJiXHyZer4nMJeLlRXS3Z4YYoLgfkrz3Yo=";
|
|
};
|
|
|
|
# will probably be fixed in https://github.com/NixOS/nixpkgs/pull/302481
|
|
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
substituteInPlace Makefile \
|
|
--replace-fail "-flto" ""
|
|
'';
|
|
|
|
nativeBuildInputs = [
|
|
pkg-config
|
|
makeBinaryWrapper
|
|
];
|
|
|
|
buildInputs = [
|
|
gtk3
|
|
SDL2
|
|
glew
|
|
];
|
|
|
|
# Note: menu.bin cannot be generated yet, because it would
|
|
# need the `vasmm68k_mot` executable (part of vbcc for amigaos68k
|
|
# Luckily, menu.bin doesn't need to be present for the emulator to function
|
|
|
|
makeFlags = [ "HOST_ZLIB=1" ];
|
|
|
|
env.NIX_CFLAGS_COMPILE = "-I${lib.getDev SDL2}/include/SDL2";
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
# not sure if any executable other than blastem is really needed here
|
|
install -Dm755 blastem dis zdis termhelper -t $out/share/blastem
|
|
install -Dm644 gamecontrollerdb.txt default.cfg rom.db -t $out/share/blastem
|
|
cp -r shaders $out/share/blastem/shaders
|
|
|
|
# wrapping instead of sym-linking makes sure argv0 stays at the original location
|
|
makeWrapper $out/share/blastem/blastem $out/bin/blastem
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru.tests.version = testers.testVersion {
|
|
package = finalAttrs.finalPackage;
|
|
command = "blastem -v";
|
|
version = "0.6.3-pre"; # remove line when moving to a stable version
|
|
};
|
|
|
|
meta = {
|
|
description = "Fast and accurate Genesis emulator";
|
|
homepage = "https://www.retrodev.com/blastem/";
|
|
license = lib.licenses.gpl3Plus;
|
|
mainProgram = "blastem";
|
|
maintainers = with lib.maintainers; [ tomasajt ];
|
|
platforms = [
|
|
"i686-linux"
|
|
"x86_64-linux"
|
|
];
|
|
};
|
|
})
|