1{ stdenv
2, lib
3, blackmagic-desktop-video
4, kernel
5}:
6
7stdenv.mkDerivation rec {
8 pname = "decklink";
9
10 # the download is a horrible curl mess. we reuse it between the kernel module
11 # and desktop service, since the version of the two have to match anyways.
12 # See pkgs/tools/video/blackmagic-desktop-video/default.nix for more.
13 inherit (blackmagic-desktop-video) src version;
14
15 KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
16 INSTALL_MOD_PATH = placeholder "out";
17
18 nativeBuildInputs = kernel.moduleBuildDependencies;
19
20 postUnpack = ''
21 tar xf Blackmagic_Desktop_Video_Linux_${lib.versions.majorMinor version}/other/${stdenv.hostPlatform.uname.processor}/desktopvideo-${version}-${stdenv.hostPlatform.uname.processor}.tar.gz
22 moduleRoot=$NIX_BUILD_TOP/desktopvideo-${version}-${stdenv.hostPlatform.uname.processor}/usr/src
23 '';
24
25
26 buildPhase = ''
27 runHook preBuild
28
29 make -C $moduleRoot/blackmagic-${version} -j$NIX_BUILD_CORES
30 make -C $moduleRoot/blackmagic-io-${version} -j$NIX_BUILD_CORES
31
32 runHook postBuild
33 '';
34
35 installPhase = ''
36 runHook preInstall
37
38 make -C $KERNELDIR M=$moduleRoot/blackmagic-${version} modules_install
39 make -C $KERNELDIR M=$moduleRoot/blackmagic-io-${version} modules_install
40
41 runHook postInstall
42 '';
43
44 meta = with lib; {
45 homepage = "https://www.blackmagicdesign.com/support/family/capture-and-playback";
46 maintainers = [ maintainers.hexchen ];
47 license = licenses.unfree;
48 description = "Kernel module for the Blackmagic Design Decklink cards";
49 sourceProvenance = with lib.sourceTypes; [ binaryFirmware ];
50 platforms = platforms.linux;
51 };
52}