]> git.scottworley.com Git - srec/commitdiff
A NixOS module for loading and configuring the v4l2loopback kernel module
authorScott Worley <scottworley@scottworley.com>
Mon, 6 Oct 2025 00:31:55 +0000 (17:31 -0700)
committerScott Worley <scottworley@scottworley.com>
Mon, 6 Oct 2025 00:31:55 +0000 (17:31 -0700)
modules/v4l2loopback.nix [new file with mode: 0644]

diff --git a/modules/v4l2loopback.nix b/modules/v4l2loopback.nix
new file mode 100644 (file)
index 0000000..e4618c7
--- /dev/null
@@ -0,0 +1,11 @@
+# h/t: https://askubuntu.com/questions/165727/is-it-possible-for-two-processes-to-access-the-webcam-at-the-same-time
+# h/t: https://www.reddit.com/r/NixOS/comments/p8bqvu/how_to_install_v4l2looback_kernel_module/
+
+{ config, ... }: {
+  boot.extraModulePackages = with config.boot.kernelPackages;
+    [ v4l2loopback.out ];
+  boot.kernelModules = [ "v4l2loopback" ];
+  boot.extraModprobeConfig = ''
+    options v4l2loopback video_nr=9 exclusive_caps=1 card_label="Shareable Camera"
+  '';
+}