nixpkgs/pkgs/by-name/sn/snes9x/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

147 lines
3.2 KiB
Nix

{
lib,
SDL2,
alsa-lib,
cmake,
fetchFromGitHub,
gtkmm3,
libGL,
libX11,
libXdmcp,
libXext,
libXinerama,
libXrandr,
libXv,
libepoxy,
libpng,
libselinux,
minizip,
ninja,
pcre2,
pkg-config,
portaudio,
pulseaudio,
python3,
stdenv,
util-linuxMinimal,
wrapGAppsHook3,
zlib,
# Boolean flags
withGtk ? false,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "snes9x" + lib.optionalString withGtk "-gtk";
version = "1.63";
src = fetchFromGitHub {
owner = "snes9xgit";
repo = "snes9x";
rev = finalAttrs.version;
fetchSubmodules = true;
hash = "sha256-INMVyB3alwmsApO7ToAaUWgh7jlg2MeLxqHCEnUO88U=";
};
nativeBuildInputs =
[
pkg-config
python3
]
++ lib.optionals withGtk [
cmake
ninja
wrapGAppsHook3
];
buildInputs =
[
libX11
libXv
minizip
zlib
]
++ lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib
pulseaudio
libselinux
util-linuxMinimal # provides libmount
]
++ lib.optionals (!withGtk) [
libpng
libXext
libXinerama
]
++ lib.optionals withGtk [
gtkmm3
libepoxy
libXdmcp
libXrandr
pcre2
portaudio
SDL2
];
hardeningDisable = [ "format" ];
configureFlags =
lib.optionals stdenv.hostPlatform.sse4_1Support [
"--enable-sse41"
]
++ lib.optionals stdenv.hostPlatform.avx2Support [
"--enable-avx2"
];
postPatch = ''
substituteInPlace external/glad/src/egl.c \
--replace-fail libEGL.so.1 "${lib.getLib libGL}/lib/libEGL.so.1"
substituteInPlace external/glad/src/glx.c \
--replace-fail libGL.so.1 ${lib.getLib libGL}/lib/libGL.so.1
'';
preConfigure = ''
cd ${if withGtk then "gtk" else "unix"}
'';
installPhase = lib.optionalString (!withGtk) ''
runHook preInstall
install -Dm755 snes9x -t "$out/bin/"
install -Dm644 snes9x.conf.default -t "$out/share/doc/${finalAttrs.pname}/"
install -Dm644 ../docs/{control-inputs,controls,snapshots}.txt -t \
"$out/share/doc/${finalAttrs.pname}/"
runHook postInstall
'';
enableParallelBuilding = true;
meta =
let
interface = if withGtk then "GTK" else "X11";
in
{
homepage = "https://www.snes9x.com";
description = "Super Nintendo Entertainment System (SNES) emulator, ${interface} version";
longDescription = ''
Snes9x is a portable, freeware Super Nintendo Entertainment System (SNES)
emulator. It basically allows you to play most games designed for the SNES
and Super Famicom Nintendo game systems on your PC or Workstation; which
includes some real gems that were only ever released in Japan.
Version build with ${interface} interface.
'';
license = lib.licenses.unfreeRedistributable // {
url = "https://github.com/snes9xgit/snes9x/blob/${finalAttrs.src.rev}/LICENSE";
};
mainProgram = "snes9x";
maintainers = with lib.maintainers; [
AndersonTorres
qknight
thiagokokada
sugar700
];
platforms = lib.platforms.unix;
broken = (withGtk && stdenv.hostPlatform.isDarwin);
};
})