1{ stdenv, fetchurl, kernel, kmod }:
2
3stdenv.mkDerivation rec {
4 name = "v4l2loopback-${version}-${kernel.version}";
5 version = "0.9.1";
6
7 src = fetchurl {
8 url = "https://github.com/umlaeute/v4l2loopback/archive/v${version}.tar.gz";
9 sha256 = "1crkhxlnskqrfj3f7jmiiyi5m75zmj7n0s26xz07wcwdzdf2p568";
10 };
11
12 preBuild = ''
13 substituteInPlace Makefile --replace "modules_install" "INSTALL_MOD_PATH=$out modules_install"
14 sed -i '/depmod/d' Makefile
15 export PATH=${kmod}/sbin:$PATH
16 '';
17
18 buildInputs = [ kmod ];
19
20 makeFlags = [
21 "KERNELRELEASE=${kernel.modDirVersion}"
22 "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
23 ];
24
25 meta = with stdenv.lib; {
26 description = "A kernel module to create V4L2 loopback devices";
27 homepage = https://github.com/umlaeute/v4l2loopback;
28 license = licenses.gpl2;
29 maintainers = [ maintainers.iElectric ];
30 platforms = platforms.linux;
31 };
32}