1{ lib, stdenv, kernel, looking-glass-client }:
2
3stdenv.mkDerivation {
4 pname = "kvmfr";
5 version = looking-glass-client.version;
6
7 src = looking-glass-client.src;
8 sourceRoot = "${looking-glass-client.src.name}/module";
9 patches = lib.optional (kernel.kernelAtLeast "6.4") [
10 ./linux-6-4-compat.patch
11 ];
12 hardeningDisable = [ "pic" "format" ];
13 nativeBuildInputs = kernel.moduleBuildDependencies;
14
15 makeFlags = [
16 "KVER=${kernel.modDirVersion}"
17 "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
18 ];
19
20 installPhase = ''
21 install -D kvmfr.ko -t "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/misc/"
22 '';
23
24 meta = with lib; {
25 description = "Optional kernel module for LookingGlass";
26 longDescription = ''
27 This kernel module implements a basic interface to the IVSHMEM device for LookingGlass when using LookingGlass in VM->VM mode
28 Additionally, in VM->host mode, it can be used to generate a shared memory device on the host machine that supports dmabuf
29 '';
30 homepage = "https://github.com/gnif/LookingGlass";
31 license = licenses.gpl2Plus;
32 maintainers = with maintainers; [ j-brn ];
33 platforms = [ "x86_64-linux" ];
34 broken = kernel.kernelOlder "5.3";
35 };
36}