23 stdenv.mkDerivation (finalAttrs: {
25 version = "115-unstable-2024-02-17";
27 src = fetchFromGitHub {
30 rev = "ba4b918c0bbcc302e0d5d2ed70f2c56214d62681";
31 hash = "sha256-M8WaPrOPSRKxhYcf6ffNkDzITkCltNF9c/zl0GmfJrI=";
36 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
43 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
55 ++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
63 # Includes cmath header
64 ./001-include-cmath.patch
65 # Uses png2icns instead of sips
66 ./002-sips-to-png2icns.patch
71 enableParallelBuilding = true;
75 if stdenv.hostPlatform.isLinux
77 else if stdenv.hostPlatform.isDarwin
79 else if stdenv.hostPlatform.isBSD
81 else if stdenv.hostPlatform.isWindows
83 else throw "Unknown platform for higan: ${stdenv.hostPlatform.system}";
87 make -C higan-ui -j$NIX_BUILD_CORES \
88 compiler=${stdenv.cc.targetPrefix}c++ \
89 platform=${platform} \
94 cores="cv fc gb gba md ms msx ngp pce sfc sg ws"
96 make -C icarus -j$NIX_BUILD_CORES \
97 compiler=${stdenv.cc.targetPrefix}c++ \
98 platform=${platform} \
108 '' + (if stdenv.hostPlatform.isDarwin then ''
109 mkdir ${placeholder "out"}
110 mv higan/out/higan.app ${placeholder "out"}/
111 mv icarus/out/icarus.app ${placeholder "out"}/
113 install -d ${placeholder "out"}/bin
114 install higan-ui/out/higan -t ${placeholder "out"}/bin/
115 install icarus/out/icarus -t ${placeholder "out"}/bin/
117 install -d ${placeholder "out"}/share/applications
118 install higan-ui/resource/higan.desktop -t ${placeholder "out"}/share/applications/
119 install icarus/resource/icarus.desktop -t ${placeholder "out"}/share/applications/
121 install -d ${placeholder "out"}/share/pixmaps
122 install higan/higan/resource/higan.svg ${placeholder "out"}/share/pixmaps/higan-icon.svg
123 install higan/higan/resource/logo.png ${placeholder "out"}/share/pixmaps/higan-icon.png
124 install icarus/resource/icarus.svg ${placeholder "out"}/share/pixmaps/icarus-icon.svg
125 install icarus/resource/icarus.png ${placeholder "out"}/share/pixmaps/icarus-icon.png
127 install -d ${placeholder "out"}/share/higan
128 cp -rd extras/ higan/System/ ${placeholder "out"}/share/higan/
130 install -d ${placeholder "out"}/share/icarus
131 cp -rd icarus/Database icarus/Firmware ${placeholder "out"}/share/icarus/
133 # A dirty workaround, suggested by @cpages:
134 # we create a first-run script to populate
135 # $HOME with all the stuff needed at runtime
137 dest = if stdenv.hostPlatform.isDarwin
138 then "\\$HOME/Library/Application Support/higan"
139 else "\\$HOME/higan";
141 mkdir -p ${placeholder "out"}/bin
142 cat <<EOF > ${placeholder "out"}/bin/higan-init.sh
145 cp --recursive --update ${placeholder "out"}/share/higan/System/ "${dest}"/
149 chmod +x ${placeholder "out"}/bin/higan-init.sh
155 passthru.updateScript = unstableGitUpdater {};
158 homepage = "https://github.com/higan-emu/higan";
159 description = "Open-source, cycle-accurate multi-system emulator";
161 higan is a multi-system emulator, originally developed by Near, with an
162 uncompromising focus on accuracy and code readability.
164 It currently emulates the following systems: Famicom, Famicom Disk System,
165 Super Famicom, Super Game Boy, Game Boy, Game Boy Color, Game Boy Advance,
166 Game Boy Player, SG-1000, SC-3000, Master System, Game Gear, Mega Drive,
167 Mega CD, PC Engine, SuperGrafx, MSX, MSX2, ColecoVision, Neo Geo Pocket,
168 Neo Geo Pocket Color, WonderSwan, WonderSwan Color, SwanCrystal, Pocket
171 license = licenses.gpl3Plus;
172 maintainers = with maintainers; [ AndersonTorres ];
173 platforms = platforms.unix;
174 broken = stdenv.hostPlatform.isDarwin;
177 # TODO: select between Qt and GTK3