Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
inherit compositor-view pipewire-helper whisper-stt;
openscreen = pkgs.callPackage ./nix/package.nix {
inherit compositor-view pipewire-helper whisper-stt;
intel-media-driver =
if pkgs.stdenv.hostPlatform.isx86_64 then pkgs.intel-media-driver else null;
intel-vaapi-driver =
if pkgs.stdenv.hostPlatform.isx86_64 then pkgs.intel-vaapi-driver else null;
};
default = self.packages.${pkgs.stdenv.hostPlatform.system}.openscreen;
}
Expand Down Expand Up @@ -132,6 +136,17 @@
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
ELECTRON_OVERRIDE_DIST_PATH = "${electron}/bin";

# VA-API driver paths for hardware video acceleration (Intel, AMD, NVIDIA)
LIBVA_DRIVERS_PATH = "/run/opengl-driver/lib/dri:${
Comment thread
coderabbitai[bot] marked this conversation as resolved.
pkgs.lib.makeSearchPath "lib/dri" (
[ pkgs.mesa ]
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isx86_64 [
pkgs.intel-media-driver
pkgs.intel-vaapi-driver
]
)
}:/usr/lib/dri:/usr/lib64/dri:/usr/lib/x86_64-linux-gnu/dri";

# Playwright browser path for test:browser / test:e2e
PLAYWRIGHT_BROWSERS_PATH = "${pkgs.playwright-driver.browsers}";
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1";
Expand Down
19 changes: 19 additions & 0 deletions nix/package.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{
lib,
stdenv,
buildNpmPackage,
nodejs_22,
electron,
ffmpeg-headless,
compositor-view,
pipewire-helper,
whisper-stt,
mesa,
intel-media-driver ? null,
intel-vaapi-driver ? null,
makeWrapper,
makeDesktopItem,
copyDesktopItems,
Expand All @@ -21,6 +25,20 @@ let
# fault, not a packaging shortcut"; the same standard applies here. The only
# invocation is a decode to raw PCM, so dropping GPL costs nothing.
ffmpegLgpl = ffmpeg-headless.override { withGPL = false; };

# VA-API driver search path for hardware video acceleration (Intel, AMD, NVIDIA).
# Nix provides drivers in isolated store paths, while NixOS provides them at
# /run/opengl-driver/lib/dri and non-NixOS distributions provide them in /usr/lib/dri.
# Bundling mesa and Intel drivers (on x86) guarantees VA-API works out-of-the-box.
vaDriversPath = lib.makeSearchPath "lib/dri" (
[ mesa ]
++ lib.optionals stdenv.hostPlatform.isx86_64 (
lib.filter (d: d != null) [
intel-media-driver
intel-vaapi-driver
]
)
);
in
buildNpmPackage {
nodejs = nodejs_22;
Expand Down Expand Up @@ -119,6 +137,7 @@ buildNpmPackage {
makeWrapper "${electron}/bin/electron" "$out/bin/openscreen" \
--add-flags "$out/lib/openscreen" \
--set ELECTRON_IS_DEV 0 \
--suffix LIBVA_DRIVERS_PATH : "/run/opengl-driver/lib/dri:${vaDriversPath}:/usr/lib/dri:/usr/lib64/dri:/usr/lib/x86_64-linux-gnu/dri" \
--set OPENSCREEN_FFMPEG_PATH "${ffmpegLgpl}/bin/ffmpeg" \
--set OPENSCREEN_COMPOSITOR_VIEW_NODE "${compositor-view}/lib/compositor_view.node" \
--set OPENSCREEN_LINUX_CURSOR_HELPER_EXE "${lib.getExe pipewire-helper}" \
Expand Down
Loading