24 enableWx ? !stdenv.hostPlatform.isDarwin,
25 enableX11 ? !stdenv.hostPlatform.isDarwin,
28 stdenv.mkDerivation (finalAttrs: {
33 url = "mirror://sourceforge/project/bochs/bochs/${finalAttrs.version}/bochs-${finalAttrs.version}.tar.gz";
34 hash = "sha256-qFsTr/fYQR96nzVrpsM7X13B+7EH61AYzCOmJjnaAFk=";
50 ++ lib.optionals enableSDL2 [
53 ++ lib.optionals enableTerm [
56 ++ lib.optionals enableWx [
60 ++ lib.optionals enableX11 [
66 ++ lib.optionals stdenv.hostPlatform.isDarwin [
72 (lib.withFeature false "rfb")
73 (lib.withFeature false "vncsrv")
74 (lib.withFeature true "nogui")
76 # These will always be "yes" on NixOS
77 (lib.enableFeature true "ltdl-install")
78 (lib.enableFeature true "readline")
79 (lib.enableFeature true "all-optimizations")
80 (lib.enableFeature true "logging")
81 (lib.enableFeature true "xpm")
83 # ... whereas these, always "no"!
84 (lib.enableFeature false "cpp")
85 (lib.enableFeature false "instrumentation")
87 (lib.enableFeature false "docbook") # Broken - it requires docbook2html
89 # Dangerous options - they are marked as "incomplete/experimental" on Bochs documentation
90 (lib.enableFeature false "3dnow")
91 (lib.enableFeature false "monitor-mwait")
92 (lib.enableFeature false "raw-serial")
94 # These are completely configurable, and they don't depend of external tools
95 (lib.enableFeature true "a20-pin")
96 (lib.enableFeature true "avx")
97 (lib.enableFeature true "busmouse")
98 (lib.enableFeature true "cdrom")
99 (lib.enableFeature true "clgd54xx")
100 (lib.enableFeature true "configurable-msrs")
101 (lib.enableFeatureAs true "cpu-level" "6") # from 3 to 6
102 (lib.enableFeature true "debugger") # conflicts with gdb-stub option
103 (lib.enableFeature true "debugger-gui")
104 (lib.enableFeature true "evex")
105 (lib.enableFeature true "fpu")
106 (lib.enableFeature false "gdb-stub") # conflicts with debugger option
107 (lib.enableFeature true "handlers-chaining")
108 (lib.enableFeature true "idle-hack")
109 (lib.enableFeature true "iodebug")
110 (lib.enableFeature true "large-ramfile")
111 (lib.enableFeature true "largefile")
112 (lib.enableFeature true "pci")
113 (lib.enableFeature true "repeat-speedups")
114 (lib.enableFeature true "show-ips")
115 (lib.enableFeature true "smp")
116 (lib.enableFeatureAs true "vmx" "2")
117 (lib.enableFeature true "svm")
118 (lib.enableFeature true "trace-linking")
119 (lib.enableFeature true "usb")
120 (lib.enableFeature true "usb-ehci")
121 (lib.enableFeature true "usb-ohci")
122 (lib.enableFeature true "usb-xhci")
123 (lib.enableFeature true "voodoo")
124 (lib.enableFeature true "x86-64")
125 (lib.enableFeature true "x86-debugger")
127 ++ lib.optionals enableSDL2 [
128 (lib.withFeature true "sdl2")
130 ++ lib.optionals enableTerm [
131 (lib.withFeature true "term")
133 ++ lib.optionals enableWx [
134 (lib.withFeature true "wx")
136 ++ lib.optionals enableX11 [
137 (lib.withFeature true "x")
138 (lib.withFeature true "x11")
140 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
141 (lib.enableFeature true "e1000")
142 (lib.enableFeature true "es1370")
143 (lib.enableFeature true "ne2000")
144 (lib.enableFeature true "plugins")
145 (lib.enableFeature true "pnic")
146 (lib.enableFeature true "sb16")
149 enableParallelBuilding = true;
152 homepage = "https://bochs.sourceforge.io/";
153 description = "Open-source IA-32 (x86) PC emulator";
155 Bochs is an open-source (LGPL), highly portable IA-32 PC emulator, written
156 in C++, that runs on most popular platforms. It includes emulation of the
157 Intel x86 CPU, common I/O devices, and a custom BIOS.
159 license = lib.licenses.lgpl2Plus;
160 maintainers = with lib.maintainers; [ AndersonTorres ];
161 platforms = lib.platforms.unix;
164 # TODO: a better way to organize the options
165 # TODO: docbook (docbook-tools from RedHat mirrors should help)