about summary refs log tree commit diff stats
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix47
1 files changed, 46 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index 425040b..fccabba 100644
--- a/flake.nix
+++ b/flake.nix
@@ -71,6 +71,45 @@
 			members = [ "focaccia" "miasm" ];
 		};
 
+        # Box64
+        zydis-shared-object = pkgs.zydis.overrideAttrs (oldAttrs: {
+			cmakeFlags = (oldAttrs.cmakeFlags or []) ++ [
+			  "-DZYDIS_BUILD_SHARED_LIB=ON"
+			];
+        });
+
+        box64-patched = pkgs.stdenv.mkDerivation {
+			pname = "box64";
+			version = "74d4db";
+
+        	src = pkgs.fetchFromGitHub {
+				owner = "ptitSeb";
+				repo = "box64";
+				rev = "74d4db051b4c74aaab23b19fbb51e441448faf8e";
+				sha256 = "sha256-G6tsqXsnTrs8I47YLnuivC79IFDGfbiLSm4J2Djc0kU=";
+			};
+
+			nativeBuildInputs = with pkgs; [
+				cmake
+				python
+				pkg-config
+				zydis-shared-object
+			];
+
+			cmakeFlags = [
+				"-DDYNAREC=ON"
+				"-DHAVE_TRACE=ON"
+			];
+
+			patches = [ ./fix-box64.patch ];
+			installPhase = ''
+				runHook preInstall
+				mkdir -p $out/bin
+				cp box64 $out/bin/
+				runHook postInstall
+			'';
+        };
+
 		# Another overlay layer for flake-specific overloads
 		# This might be needed because uv does not have sufficient metadata
 		# Here, uv does include metadata about build systems used by each dependency
@@ -312,12 +351,18 @@
 					packages.dev
 					musl-pkgs.gcc
 					musl-pkgs.pkg-config
+                    box64-patched
 				];
 
 				hardeningDisable = [ "pie" ];
 
 				env = uvEnv;
-				shellHook = uvShellHook;
+				shellHook = uvShellHook + ''
+                  export BOX64_TRACE=1
+                  export BOX64_DYNAREC_TRACE=1
+                  export BOX64_DYNAREC_DF=0
+                  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${zydis-shared-object}/lib
+                '';
 			};
 		};