NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.48k stars 12.97k forks source link

Package request: Picamera2 #230426

Open zefrof opened 1 year ago

zefrof commented 1 year ago

Project description

Python library for managing raspberry pi camera.

Metadata

Faeranne commented 2 months ago

I've successfully gotten picamera2 to build under nix, but several issues make it unlikely to be acceptable for nixpkgs any time soon.

First, libcamera must be rebuilt with rpi support enabled. for whatever reason, building aarch64-linux packages still doesn't enable rpi support, and my guess is libcamera is doing some detection that nix breaks.

Second, raspberry pi has patched libcamera to build the actual python bindings, which is a clunky but necessary fix.

Third, as mentioned in #236443, python-prctl needs a small change to get it compiling again.

And finally, the biggest issue is that compiling simplejpeg as is will likely be an uphill battle. simplejpeg's build tool directly fetches multiple git repos mid-build, and would need to be patched quite a bit to remove that impurity. Fortunatly it is exclusively used for the jpeg renderer, which is only used if you save jpeg images directly from picamera2. Using any other renderer or numpy arrays bypasses it all together.

I have not tested beyond successful build and import, and I know py-kms++ still needs to be packaged too before most of picamera2 is ready to be packaged.

If someone else watching this needs a starting point for building proper nixpkgs, and wants to take on the burden, be my guest. Otherwise, I'll likely get to this in a few months, assuming I can get all the pieces together.