54 - Resolve Playwright Chromium libraries via nix-ld

This commit is contained in:
myrmidex 2026-08-19 12:38:25 +02:00
parent dcfa73b7db
commit 175290b707
3 changed files with 31 additions and 2 deletions

View file

@ -9,7 +9,18 @@ RUN apk add --no-cache \
mysql-client \
vim \
bash \
nano
nano \
chromium \
nss \
freetype \
harfbuzz \
ttf-freefont \
font-noto-emoji
# Playwright ships glibc-linked browser builds that do not run on Alpine (musl),
# so drive Alpine's own Chromium instead of downloading one.
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 \
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium-browser
# Install PHP extensions including xdebug for development
RUN install-php-extensions \

View file

@ -40,6 +40,10 @@ services:
# Vite
VITE_HOST: "0.0.0.0"
# Playwright drives Alpine's system Chromium (musl); see Dockerfile.dev
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH: "/usr/bin/chromium-browser"
volumes:
# Mount entire project for hot reload with SELinux context
- ../..:/app:Z

View file

@ -1,5 +1,17 @@
{ pkgs ? import <nixpkgs> {} }:
let
# Playwright's bundled Chromium is a prebuilt glibc binary. NixOS has no
# /usr/lib, so nix-ld (enabled system-wide) resolves its interpreter and
# NIX_LD_LIBRARY_PATH supplies the libraries below.
chromiumLibs = with pkgs; [
glib nss nspr atk at-spi2-atk at-spi2-core cups dbus expat
xorg.libxcb libxkbcommon alsa-lib libgbm mesa
xorg.libX11 xorg.libXext xorg.libXcomposite xorg.libXdamage
xorg.libXfixes xorg.libXrandr cairo pango systemd libdrm
];
in
pkgs.mkShell {
buildInputs = with pkgs; [
# PHP and tools
@ -29,6 +41,8 @@ pkgs.mkShell {
# Use keep-id for proper permission mapping in rootless podman
export PODMAN_USERNS=keep-id
export NIX_LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath chromiumLibs}:$NIX_LD_LIBRARY_PATH"
# Compose file location
COMPOSE_FILE="$PWD/docker/dev/docker-compose.yml"