I only asking for help to have nix flake crossbuild code to use picamera2.
I am a hardware guy trying to do this whole project called Cat Traption.
Cat Traption Project:
i have a working raspberry pi 2 controlling a animal trap.
I have PIR sensor for motion.
I have the python code working.
My next box, I want to add pi camera V2 to detect and ID a CAT.
on a second raspberry pi “Rpi02w” i have installed nixOS.
Flow setup : On my Desktop I installed NixOS 25.11 . I have successfully created an image for SD card for Rpi02w (crossbuild). Rpi02w boots headless. No camera yet.
Rpi02w packages. . (Nix).
packages = with pkgs; [ (let pythonEnv = python3.withPackages (ps: [ ps.opencv-python-headless ps.rpi-gpio ]); in pythonEnv) ]; };
Here is the results from ‘free -h’ on the Rpi02w.
free -h
total used free shared buff/cache available
Mem: 453Mi 112Mi 89Mi 4.1Mi 266Mi 341Mi
Swap: 226Mi 0B 226Mi
Version 1: My intent is to make this project an open source and train TnR groups (trap Neuter Return) how to use this. Field application Rpi02w, no wifi , just purely local embedded. This is for TnR cat groups so they don’t trap skunks, or any other animal. Just cats.
I will pre-process CAT ID models with the desktop machine.
Version 2.0 of cat trap, I will have a list “not this cat”. I don’t want to trap cats that has already nuetered. I can have python code take pictures of trapped cat for post-processing to make a list of already trapped cats. Somekind of face identification.
Then have raspberry pi check the file on usb stick to see if already trapped.
Cost is pretty much a concern. So I bought three pi camera v2.
My 1st version uses raspberry pi 2 (very old) and only has PIR motion sensor working. It has been used in the feild.
I know there is a huge big step between my working hardware and getting people to duplicate it. But I am stuck trying to get pi camera v2 to cross build using nix flake.
software flow -
PIR sensor to trigger camera as cat enters trap. no videos.
Decide Yes it is a cat. (not version 2.0) yet.
trigger motor, trap cat.
take up to 20 more pics of trapped cat.
Shutdown Raspberry PI (save power).
I need to add picamera2 to the Rpi02w packages.
nixpkgs don’t have picamera2, or dependecies don’t get built correctly.
Oh yea, Only in the last 8 months have I worked with NixOS. So everything is still being learned.
attached are 2 files “zero2w.nix” and “flake.nix”.
Here is the latest error I am getting. . . I guess simplejpeg uses cython but cython is not available in python3.12 ???
Yes I am getting lost in so many hiearchies of this project.
python3.12-simplejpeg> cython~=3.0.0
python3.12> reading sources… [ 28%] library/asyncio-exceptions
error: Cannot build ‘/nix/store/mdfznzslfz9hxnzm0rph9idvbaql5w85-python3.12-simplejpeg-1.8.2.drv’.
Reason: builder failed with exit code 1.
Output paths:
/nix/store/38c0j0hqak6hzdp9aflaflwkgbh68zir-python3.12-simplejpeg-1.8.2-dist
/nix/store/gh6gw7cp8yaq28kvi3m1bp1wlvdv3ha3-python3.12-simplejpeg-1.8.2
Last 25 log lines: