summaryrefslogtreecommitdiff
path: root/pkgs/os-specific/linux/v86d/default.nix
blob: 266d731854227bb40bb6f6b73d297ed6d8a3a8cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
  lib,
  stdenv,
  fetchFromGitHub,
  kernel,
  klibc,
}:

let
  pversion = "0.1.10";
in
stdenv.mkDerivation {
  pname = "v86d";
  version = "${pversion}-${kernel.version}";

  src = fetchFromGitHub {
    owner = "mjanusz";
    repo = "v86d";
    tag = "v86d-${pversion}";
    hash = "sha256-95LRzVbO/DyddmPwQNNQ290tasCGoQk7FDHlst6LkbA=";
  };

  postPatch = ''
    patchShebangs configure
  '';

  # GCC 14 makes this an error by default, remove when fixed upstream
  env.NIX_CFLAGS_COMPILE = "-Wno-implicit-function-declaration -Wno-implicit-int";

  configureFlags = [
    "--with-klibc"
    "--with-x86emu"
  ];

  hardeningDisable = [ "stackprotector" ];

  makeFlags = [
    "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source"
    "DESTDIR=$(out)"
  ];

  configurePhase = ''
    runHook preConfigure

    ./configure $configureFlags

    runHook postConfigure
  '';

  buildInputs = [ klibc ];

  meta = {
    description = "Daemon to run x86 code in an emulated environment";
    mainProgram = "v86d";
    homepage = "https://github.com/mjanusz/v86d";
    license = lib.licenses.gpl2Only;
    maintainers = [ ];
    platforms = [
      "i686-linux"
      "x86_64-linux"
    ];
  };
}