Akvcam appears to be packaged for NixOS, at least, and all the heavy lifting in that project looks to be done by opencv, which is also packaged for NixOS. I didn’t see any unsavory fhs-reliant code at a glance either.
The only potential pain in the arse will be that akvcam config. I don’t know anything about it, perhaps using environment.etc will be necessary.
Of course, getting any opencv+python thing to work is always a royal pain, but plenty of people have done so with NixOS. I’d say give packaging this a try (and consider writing a module for the akvcam config), and shout if you get stuck.
I haven’t packaged anything yet except copying shell script to $out so I probably should start with something simpler… But I’ll try and see what happens.
Has anyone tried to use something else than OBS (something simpler) on NixOS to get a virtual (fake) webcam with blur/replaced background?
I haven’t tried it on NixOS, but I have used OBS with the virtual camera feature to do this. It’s pretty simple to create a ‘Scene’ in OBS containing a chroma key removal for your camera, which replaces the background with some other image or colour. I did not continue using it because the lighting in my room was too poor, meaning that my shadow confused the chroma keying. It worked very well in broad daylight though. There was the apparent limitation that only 720p resolution worked when using online videoconferencing - this I imaigne was a browser/website issue and not an OBS one.
OBS now contains the virtual camera feature, so you shouldn’t need to install any plugins to make this work. It does not however contain any ‘intelligent’ background removal; you’ll need to ensure that the background is distinctive yourself with something like a green sheet (or in my case, a very large light green blackout blind).
I looked at @chrismdot files on Github (thank you so much for that) and I added v4l2loopbackboot.extraModulePackages so I can create a virtual camera via OBS.
I also added "v4l2loopback" into boot.kernelModules since my user can’t use sudo and therefore it can’t easily modprobe v4l2loopback.
But…
Is it possible in NixOS to do the following at boot?