33 stdenv.mkDerivation (finalAttrs: {
34 pname = "snes9x" + lib.optionalString withGtk "-gtk";
37 src = fetchFromGitHub {
40 rev = finalAttrs.version;
41 fetchSubmodules = true;
42 hash = "sha256-INMVyB3alwmsApO7ToAaUWgh7jlg2MeLxqHCEnUO88U=";
50 ++ lib.optionals withGtk [
63 ++ lib.optionals stdenv.hostPlatform.isLinux [
67 util-linuxMinimal # provides libmount
69 ++ lib.optionals (!withGtk) [
74 ++ lib.optionals withGtk [
84 hardeningDisable = [ "format" ];
87 lib.optionals stdenv.hostPlatform.sse4_1Support [
90 ++ lib.optionals stdenv.hostPlatform.avx2Support [
95 substituteInPlace external/glad/src/egl.c \
96 --replace-fail libEGL.so.1 "${lib.getLib libGL}/lib/libEGL.so.1"
97 substituteInPlace external/glad/src/glx.c \
98 --replace-fail libGL.so.1 ${lib.getLib libGL}/lib/libGL.so.1
102 cd ${if withGtk then "gtk" else "unix"}
105 installPhase = lib.optionalString (!withGtk) ''
108 install -Dm755 snes9x -t "$out/bin/"
109 install -Dm644 snes9x.conf.default -t "$out/share/doc/${finalAttrs.pname}/"
110 install -Dm644 ../docs/{control-inputs,controls,snapshots}.txt -t \
111 "$out/share/doc/${finalAttrs.pname}/"
116 enableParallelBuilding = true;
120 interface = if withGtk then "GTK" else "X11";
123 homepage = "https://www.snes9x.com";
124 description = "Super Nintendo Entertainment System (SNES) emulator, ${interface} version";
126 Snes9x is a portable, freeware Super Nintendo Entertainment System (SNES)
127 emulator. It basically allows you to play most games designed for the SNES
128 and Super Famicom Nintendo game systems on your PC or Workstation; which
129 includes some real gems that were only ever released in Japan.
131 Version build with ${interface} interface.
133 license = lib.licenses.unfreeRedistributable // {
134 url = "https://github.com/snes9xgit/snes9x/blob/${finalAttrs.src.rev}/LICENSE";
136 mainProgram = "snes9x";
137 maintainers = with lib.maintainers; [
143 platforms = lib.platforms.unix;
144 broken = (withGtk && stdenv.hostPlatform.isDarwin);