Bind all /dev/video* for camera combinator
This updates the `camera` combinator to bind all `/dev/video*` devices found at runtime. This also means bubblewrap won't crash if `camera` is specified but there is no camera attached.
This commit is contained in:
parent
2f2bea6e74
commit
f54d444e2a
1 changed files with 6 additions and 1 deletions
|
|
@ -18,7 +18,12 @@ in rec {
|
||||||
set-hostname = hostname: state: state // { inherit hostname; };
|
set-hostname = hostname: state: state // { inherit hostname; };
|
||||||
|
|
||||||
tmpfs = path: unsafe-add-raw-args "--tmpfs ${escape path}";
|
tmpfs = path: unsafe-add-raw-args "--tmpfs ${escape path}";
|
||||||
camera = unsafe-add-raw-args "--dev-bind /dev/video0 /dev/video0";
|
camera = add-runtime ''
|
||||||
|
for v in /dev/video*; do
|
||||||
|
[ -e "$v" ] || continue
|
||||||
|
RUNTIME_ARGS+=(--dev-bind "$v" "$v")
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
# safety: jail/lib.nix asserts that name is a valid shell variable name
|
# safety: jail/lib.nix asserts that name is a valid shell variable name
|
||||||
fwd-env = name: set-env name (noescape "\"\$${name}\"");
|
fwd-env = name: set-env name (noescape "\"\$${name}\"");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue