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