-
Notifications
You must be signed in to change notification settings - Fork 0
/
vmware-kernel.nix
53 lines (48 loc) · 1.16 KB
/
vmware-kernel.nix
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
{ stdenv
, kernel
, patch
, gcc
, gnumake
}:
let
kversion = "${kernel.modDirVersion}";
kinclude = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build/include/";
in
version: patches: vmware-bundle:
stdenv.mkDerivation {
pname = "vmware-kernel";
inherit version;
srcs = [
"${vmware-bundle}/vmware-vmx/lib/modules/source/vmmon.tar"
"${vmware-bundle}/vmware-vmx/lib/modules/source/vmnet.tar"
];
sourceRoot = ".";
hardeningDisable = [ "all" ];
buildInputs = [
gcc
gnumake
patch
vmware-bundle
patches
];
nativeBuildInputs = kernel.moduleBuildDependencies;
patchPhase = ''
cp -r ./vmmon-only ./vmmon
cp -r ./vmnet-only ./vmnet
${patch}/bin/patch -p1 < ${patches}/vmmon.patch
${patch}/bin/patch -p1 < ${patches}/vmnet.patch
'';
buildPhase = ''
export KVERSION=${kversion}
export LINUXINCLUDE=${kinclude}
export VM_KBUILD=yes
make -C ./vmmon
make -C ./vmnet
'';
installPhase = ''
binDir="$out/lib/modules/${kversion}/kernel/"
mkdir -p $binDir
cp ./vmmon/*.ko $binDir
cp ./vmnet/*.ko $binDir
'';
}