1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 kernel,
6 klibc,
7}:
8
9let
10 pversion = "0.1.10";
11in
12stdenv.mkDerivation {
13 pname = "v86d";
14 version = "${pversion}-${kernel.version}";
15
16 src = fetchFromGitHub {
17 owner = "mjanusz";
18 repo = "v86d";
19 tag = "v86d-${pversion}";
20 hash = "sha256-95LRzVbO/DyddmPwQNNQ290tasCGoQk7FDHlst6LkbA=";
21 };
22
23 postPatch = ''
24 patchShebangs configure
25 '';
26
27 # GCC 14 makes this an error by default, remove when fixed upstream
28 env.NIX_CFLAGS_COMPILE = "-Wno-implicit-function-declaration -Wno-implicit-int";
29
30 configureFlags = [
31 "--with-klibc"
32 "--with-x86emu"
33 ];
34
35 hardeningDisable = [ "stackprotector" ];
36
37 makeFlags = [
38 "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source"
39 "DESTDIR=$(out)"
40 ];
41
42 configurePhase = ''
43 runHook preConfigure
44
45 ./configure $configureFlags
46
47 runHook postConfigure
48 '';
49
50 buildInputs = [ klibc ];
51
52 meta = {
53 description = "Daemon to run x86 code in an emulated environment";
54 mainProgram = "v86d";
55 homepage = "https://github.com/mjanusz/v86d";
56 license = lib.licenses.gpl2Only;
57 maintainers = with lib.maintainers; [ codyopel ];
58 platforms = [
59 "i686-linux"
60 "x86_64-linux"
61 ];
62 };
63}