Files
ryan4yin | 二花 c277c81cd6 feat(nixpak): sandbox six desktop apps (#497)
* feat(nixpak): sandbox six desktop apps

* chore(nixpak): trim OBS plugin set

* fix(nixpak): enable OBS on aarch64

* fix(nixpak): let imv read the full home directory

* fix(home): drop redundant freerdp package

* fix(nixpak): grant OBS access to V4L2 camera devices

* fix(nixpak): expose V4L2 sysfs to OBS

* fix(nixpak): expose NVIDIA encode library to OBS

* docs(nixpak): record OBS interactive validation

* docs(nixpak): record OBS RTMP validation

* fix(nixpak): run MuseScore via XWayland and PulseAudio

* docs(nixpak): explain app sandboxing rationale

* fix(nixpak): route MuseScore ALSA through PipeWire
2026-11-01 01:24:47 -05:00

61 lines
1.7 KiB
Nix

# OBS capture policy: screen capture stays on the XDG portal, audio goes
# through PulseAudio/PipeWire-Pulse, and network access is pasta-isolated.
# OBS's V4L2 source opens camera device nodes directly instead of using the
# Camera portal, so grant the same raw video devices as Zoom.
{
sloth,
...
}:
{
imports = [
./desktop-base.nix
./network.nix
];
pasta.mode = "isolate";
portalGroups = {
fileChooser = true;
openUri = true;
notifications = true;
screenCast = true;
camera = true;
inhibit = true;
inputMethod = true;
};
desktopIntegration = {
notifications = true;
tray = true;
accessibility = true;
};
bubblewrap = {
sockets = {
x11 = true;
pulse = true;
};
bind.rw = [
(sloth.mkdir (sloth.concat' sloth.homeDir "/.config/obs-studio"))
sloth.xdgVideosDir
sloth.xdgPicturesDir
sloth.xdgDownloadDir
];
# OBS enumerates DRM connectors when building its encoder list, and its
# V4L2 source discovers cameras by reading /sys/class/video4linux before
# opening the corresponding /dev/video* nodes.
bind.ro = [
"/sys/class/drm"
"/sys/class/video4linux"
];
bind.dev = [
"/dev/video0"
"/dev/video1"
];
env = {
DISPLAY = sloth.envOr "DISPLAY" "";
XAUTHORITY = sloth.envOr "XAUTHORITY" (sloth.concat' sloth.homeDir "/.Xauthority");
# OBS's NVENC plugin dlopen()s libnvidia-encode.so.1 by soname after
# startup. Nixpak exposes the host driver under /run/opengl-driver but
# clears the host environment, so add it to the loader search path.
LD_LIBRARY_PATH = "/run/opengl-driver/lib";
};
};
}