at 25.11-pre 62 lines 2.2 kB view raw
1{ 2 stdenv, 3 lib, 4 blackmagic-desktop-video, 5 kernel, 6 fetchpatch, 7}: 8stdenv.mkDerivation (finalAttrs: { 9 pname = "decklink"; 10 11 # the download is a horrible curl mess. we reuse it between the kernel module 12 # and desktop service, since the version of the two have to match anyways. 13 # See pkgs/by-name/bl/blackmagic-desktop-video/package.nix for more. 14 inherit (blackmagic-desktop-video) src version; 15 16 patches = lib.optionals (lib.versionAtLeast kernel.modDirVersion "6.13") [ 17 # needed for version 14.4.x to build for kernel 6.13 18 (fetchpatch { 19 name = "01-update-makefiles"; 20 url = "https://aur.archlinux.org/cgit/aur.git/plain/01-update-makefiles.patch?h=decklink"; 21 hash = "sha256-l3iu0fG/QJMdGI/WSlNn+qjF4nK25JxoiwhPrMGTqE4="; 22 }) 23 ]; 24 25 KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"; 26 INSTALL_MOD_PATH = placeholder "out"; 27 28 nativeBuildInputs = kernel.moduleBuildDependencies; 29 30 postUnpack = 31 let 32 arch = stdenv.hostPlatform.uname.processor; 33 in 34 '' 35 tar xf Blackmagic_Desktop_Video_Linux_${lib.head (lib.splitString "a" finalAttrs.version)}/other/${arch}/desktopvideo-${finalAttrs.version}-${arch}.tar.gz 36 moduleRoot=$NIX_BUILD_TOP/desktopvideo-${finalAttrs.version}-${stdenv.hostPlatform.uname.processor}/usr/src 37 sourceRoot=$moduleRoot 38 ''; 39 40 buildPhase = '' 41 runHook preBuild 42 make -C $moduleRoot/blackmagic-${finalAttrs.version} -j$NIX_BUILD_CORES 43 make -C $moduleRoot/blackmagic-io-${finalAttrs.version} -j$NIX_BUILD_CORES 44 runHook postBuild 45 ''; 46 47 installPhase = '' 48 runHook preInstall 49 make -C $KERNELDIR M=$moduleRoot/blackmagic-${finalAttrs.version} modules_install 50 make -C $KERNELDIR M=$moduleRoot/blackmagic-io-${finalAttrs.version} modules_install 51 runHook postInstall 52 ''; 53 54 meta = with lib; { 55 homepage = "https://www.blackmagicdesign.com/support/family/capture-and-playback"; 56 maintainers = [ maintainers.naxdy ]; 57 license = licenses.unfree; 58 description = "Kernel module for the Blackmagic Design Decklink cards"; 59 sourceProvenance = with lib.sourceTypes; [ binaryFirmware ]; 60 platforms = platforms.linux; 61 }; 62})