30 stdenv.mkDerivation (finalAttrs: {
32 version = "2024.12.04";
34 src = fetchFromGitHub {
35 owner = "joncampbell123";
37 rev = "dosbox-x-v${finalAttrs.version}";
38 hash = "sha256-wZCLwEInUfzuOCcUsz8W+Gi00lp4Nwc0QZjLF8/e9iM=";
41 # sips is unavailable in sandbox, replacing with imagemagick breaks build due to wrong Foundation propagation(?) so don't generate resolution variants
42 # iconutil is unavailable, replace with png2icns from libicns
43 # Patch bad hardcoded compiler
44 # Don't mess with codesign, doesn't seem to work?
46 substituteInPlace Makefile.am \
47 --replace-fail 'sips' '## sips' \
48 --replace-fail 'iconutil -c icns -o contrib/macos/dosbox.icns src/dosbox.iconset' 'png2icns contrib/macos/dosbox.icns contrib/macos/dosbox-x.png' \
49 --replace-fail 'g++' "$CXX" \
50 --replace-fail 'codesign' '## codesign'
51 '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
52 patchShebangs appbundledeps.py
61 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
78 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
82 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
88 # Tests for SDL_net.h for modem & IPX support, not automatically picked up due to being in SDL2 subdirectory
89 env.NIX_CFLAGS_COMPILE = "-I${lib.getDev SDL2_net}/include/SDL2";
91 configureFlags = [ "--enable-sdl2" ];
93 enableParallelBuilding = true;
95 hardeningDisable = [ "format" ]; # https://github.com/joncampbell123/dosbox-x/issues/4436
97 # Build optional App Bundle target, which needs at least one arch-suffixed binary
98 postBuild = lib.optionalString stdenv.hostPlatform.isDarwin ''
99 cp src/dosbox-x src/dosbox-x-$(uname -m)
103 postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
104 wrapProgram $out/bin/dosbox-x \
105 --prefix PATH : ${lib.makeBinPath [ yad ]}
107 # Install App Bundle, wrap regular binary into bundle's binary to get the icon working
108 + lib.optionalString stdenv.hostPlatform.isDarwin ''
109 mkdir $out/Applications
110 mv dosbox-x.app $out/Applications/
111 mv $out/bin/dosbox-x $out/Applications/dosbox-x.app/Contents/MacOS/dosbox-x
112 makeWrapper $out/Applications/dosbox-x.app/Contents/MacOS/dosbox-x $out/bin/dosbox-x
115 passthru.tests.version = testers.testVersion {
116 package = finalAttrs.finalPackage;
117 # Version output on stderr, program returns status code 1
118 command = "${lib.getExe finalAttrs.finalPackage} -version 2>&1 || true";
122 homepage = "https://dosbox-x.com";
123 description = "Cross-platform DOS emulator based on the DOSBox project";
125 DOSBox-X is an expanded fork of DOSBox with specific focus on running
126 Windows 3.x/9x/Me, PC-98 and 3D support via 3dfx.
128 The full expanded feature list is available here:
129 https://dosbox-x.com/wiki/DOSBox%E2%80%90X%E2%80%99s-Feature-Highlights
131 license = lib.licenses.gpl2Plus;
132 maintainers = with lib.maintainers; [ hughobrien OPNA2608 ];
133 platforms = lib.platforms.unix;
134 mainProgram = "dosbox-x";