Files
nix-config/pkgs/libcamera-rpi/package.nix

67 lines
1.4 KiB
Nix

{
lib,
fetchFromGitHub,
libcamera,
boost,
nlohmann_json,
python3Packages,
git,
cacert,
meson,
}:
libcamera.overrideAttrs (old: {
buildInputs = old.buildInputs ++ [
boost
nlohmann_json
];
nativeBuildInputs = old.nativeBuildInputs ++ [ python3Packages.pybind11 ];
BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
patches = [
./patches/libcamera-installed.patch
./patches/libcamera-no-timeout.patch
];
postPatch =
old.postPatch
+ ''
patchShebangs src/py/libcamera
'';
preBuild = ''
ninja src/ipa-priv-key.pem
install -D ${./libcamera-rpi-ipa-priv-key.pem} src/ipa-priv-key.pem
'';
mesonFlags = old.mesonFlags ++ [
"--buildtype=release"
"-Dcam=disabled"
"-Dgstreamer=disabled"
"-Dipas=rpi/vc4,rpi/pisp"
"-Dpipelines=rpi/vc4,rpi/pisp"
"-Dtest=false"
];
src = fetchFromGitHub {
owner = "raspberrypi";
repo = "libcamera";
rev = "d83ff0a4ae4503bc56b7ed48cd142c3dd423ad3b";
sha256 = "sha256-VP0s1jOON9J3gn81aiemsChvGeqx0PPivQF5rmSga6M=";
nativeBuildInputs = [ git ];
postFetch = ''
cd "$out"
export NIX_SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
${lib.getExe meson} subprojects download \
libpisp
find subprojects -type d -name .git -prune -execdir rm -r {} +
'';
};
})