From 699bbc83c1e5aaa571757caa509202dbbd775d09 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Wed, 9 Sep 2026 22:30:58 +0200 Subject: [PATCH] dosbox-x: Add a basic installCheck Start up its PC-98 machine emulation and run `VER` to get the emulated DOS version. Would like to do smth more complex (custom DOS binary that uses INT 21h, AH=09h to print the text, or maybe some interrupts more specific to the PC-98 series to test if it's actually emulating the right machine), but would need OpenWatcom for compiling that, which we consider unfree due to the Sybase Open Watcom Public License being quite badly written. --- pkgs/by-name/do/dosbox-x/package.nix | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/pkgs/by-name/do/dosbox-x/package.nix b/pkgs/by-name/do/dosbox-x/package.nix index 8d50ea58fbb1..dad8b9f33752 100644 --- a/pkgs/by-name/do/dosbox-x/package.nix +++ b/pkgs/by-name/do/dosbox-x/package.nix @@ -3,6 +3,7 @@ stdenv, fetchFromGitHub, gitUpdater, + writers, alsa-lib, autoreconfHook, ffmpeg, @@ -27,6 +28,14 @@ zlib, }: +let + check-dosbox-conf = writers.writeText "check-dosbox.conf" '' + [autoexec] + MOUNT C . + + VER > C:\BLUB + ''; +in stdenv.mkDerivation (finalAttrs: { pname = "dosbox-x"; version = "2026.08.31"; @@ -111,6 +120,26 @@ stdenv.mkDerivation (finalAttrs: { makeWrapper $out/Applications/dosbox-x.app/Contents/MacOS/dosbox-x $out/bin/dosbox-x ''; + # Can't personally check Darwin anymore + doInstallCheck = !stdenv.hostPlatform.isDarwin; + + installCheckPhase = '' + runHook preInstallCheck + + env \ + SDL_AUDIODRIVER=dummy \ + SDL_VIDEODRIVER=dummy \ + $out/bin/dosbox-x \ + -nopromptfolder -nogui \ + -exit \ + -machine pc98 \ + -conf ${check-dosbox-conf} + + grep -q 'Reported DOS version' BLUB + + runHook postInstallCheck + ''; + passthru = { tests.version = testers.testVersion { package = finalAttrs.finalPackage;