ajantv2-nix/aja-ntv2/driver.nix

36 lines
1.2 KiB
Nix
Raw Permalink Normal View History

2023-10-02 22:56:38 +01:00
{
stdenv,
nukeReferences,
kernel,
2023-10-13 20:56:15 +01:00
aja-src,
2023-10-02 22:56:38 +01:00
}:
stdenv.mkDerivation {
name = "ajantv2-driver-${kernel.version}";
2023-10-13 20:56:15 +01:00
src = aja-src;
2023-10-02 22:56:38 +01:00
patches = [./lol.patch ./newkernels.patch];
nativeBuildInputs = kernel.moduleBuildDependencies;
buildInputs = [nukeReferences];
# the makefile symlinks some files, which can't be done at build time, so do it here
# and patch out the offending bits of makefile (lol.patch)
postUnpack = ''
cp source/ajalibraries/ajantv2/src/ntv2devicefeatures.cpp source/ajadriver/linux/ntv2devicefeatures.c
cp source/ajalibraries/ajantv2/src/ntv2driverprocamp.cpp source/ajadriver/linux/ntv2driverprocamp.c
cp source/ajalibraries/ajantv2/src/ntv2vpidfromspec.cpp source/ajadriver/linux/ntv2vpidfromspec.c
'';
# AJA_CREATE_DEVICE_NODES causes the driver to automatically create /dev nodes rather
# than need to use the weird load_ajantv2 script
makeFlags = [
"AJA_CREATE_DEVICE_NODES=1"
"KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
"--directory=ajadriver/linux"
];
installPhase = ''
mkdir -p $out/lib/modules/${kernel.modDirVersion}/misc
for x in $(find . -name '*.ko'); do
nuke-refs $x
cp $x $out/lib/modules/${kernel.modDirVersion}/misc/
done
'';
}