depot/third_party/nixpkgs/pkgs/os-specific/linux/v4l2loopback/default.nix
Default email 159e378cbb Project import generated by Copybara.
GitOrigin-RevId: c04d5652cfa9742b1d519688f65d1bbccea9eb7e
2024-09-19 17:19:46 +03:00

45 lines
1.2 KiB
Nix

{ lib, stdenv, fetchFromGitHub, kernel, kmod }:
let version = "0.13.2";
in stdenv.mkDerivation {
pname = "v4l2loopback";
version = "${version}-${kernel.version}";
src = fetchFromGitHub {
owner = "umlaeute";
repo = "v4l2loopback";
rev = "v${version}";
hash = "sha256-rcwgOXnhRPTmNKUppupfe/2qNUBDUqVb3TeDbrP5pnU=";
};
hardeningDisable = [ "format" "pic" ];
preBuild = ''
substituteInPlace Makefile --replace "modules_install" "INSTALL_MOD_PATH=$out modules_install"
sed -i '/depmod/d' Makefile
'';
nativeBuildInputs = [ kmod ] ++ kernel.moduleBuildDependencies;
postInstall = ''
make install-utils PREFIX=$bin
'';
outputs = [ "out" "bin" ];
makeFlags = kernel.makeFlags ++ [
"KERNELRELEASE=${kernel.modDirVersion}"
"KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
meta = with lib; {
description = "Kernel module to create V4L2 loopback devices";
mainProgram = "v4l2loopback-ctl";
homepage = "https://github.com/umlaeute/v4l2loopback";
license = licenses.gpl2Only;
maintainers = with maintainers; [ moni ];
platforms = platforms.linux;
outputsToInstall = [ "out" ];
};
}