9 stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isRiscV64 || stdenv.hostPlatform.isLoongArch64
15 # Currently only supported on specific archs
19 stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isRiscV64 || stdenv.hostPlatform.isLoongArch64
22 stdenv.mkDerivation (finalAttrs: {
26 src = fetchFromGitHub {
29 rev = "v${finalAttrs.version}";
30 hash = "sha256-8PpTN7lUjpmSowbaRsfSRWJQRDZICFhVvn05tQYC4PQ=";
40 (lib.cmakeBool "NOGIT" true)
43 (lib.cmakeBool "ARM64" stdenv.hostPlatform.isAarch64)
44 (lib.cmakeBool "RV64" stdenv.hostPlatform.isRiscV64)
45 (lib.cmakeBool "PPC64LE" (stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian))
46 (lib.cmakeBool "LARCH64" stdenv.hostPlatform.isLoongArch64)
48 ++ lib.optionals stdenv.hostPlatform.isx86_64 [
49 # x86_64 has no arch-specific mega-option, manually enable the options that apply to it
50 (lib.cmakeBool "LD80BITS" true)
51 (lib.cmakeBool "NOALIGN" true)
55 (lib.cmakeBool "ARM_DYNAREC" (withDynarec && stdenv.hostPlatform.isAarch64))
56 (lib.cmakeBool "RV64_DYNAREC" (withDynarec && stdenv.hostPlatform.isRiscV64))
57 (lib.cmakeBool "LARCH64_DYNAREC" (withDynarec && stdenv.hostPlatform.isLoongArch64))
63 install -Dm 0755 box64 "$out/bin/box64"
68 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
70 doInstallCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
72 installCheckPhase = ''
73 runHook preInstallCheck
75 echo Checking if it works
78 echo Checking if Dynarec option was respected
79 $out/bin/box64 -v | grep ${lib.optionalString (!withDynarec) "-v"} Dynarec
81 runHook postInstallCheck
85 updateScript = gitUpdater { rev-prefix = "v"; };
87 runCommand "box64-test-hello" { nativeBuildInputs = [ finalAttrs.finalPackage ]; }
88 # There is no actual "Hello, world!" with any of the logging enabled, and with all logging disabled it's hard to
89 # tell what problems the emulator has run into.
91 BOX64_NOBANNER=0 BOX64_LOG=1 box64 ${lib.getExe hello-x86_64} --version | tee $out
96 homepage = "https://box86.org/";
97 description = "Lets you run x86_64 Linux programs on non-x86_64 Linux systems";
98 changelog = "https://github.com/ptitSeb/box64/releases/tag/v${finalAttrs.version}";
99 license = lib.licenses.mit;
100 maintainers = with lib.maintainers; [
104 mainProgram = "box64";