This commit is contained in:
41
shell.nix
41
shell.nix
@ -11,10 +11,7 @@ let
|
||||
curl
|
||||
];
|
||||
|
||||
# Dependencies for Playwright's self-downloaded browsers (for macOS)
|
||||
playwrightSelfDownloadLibs = with pkgs; [
|
||||
glibc
|
||||
libgcc
|
||||
playwrightCommonLibs = with pkgs; [
|
||||
glib
|
||||
nss
|
||||
nspr
|
||||
@ -24,6 +21,20 @@ let
|
||||
at-spi2-core
|
||||
cups
|
||||
expat
|
||||
libxkbcommon
|
||||
cairo
|
||||
pango
|
||||
fontconfig
|
||||
freetype
|
||||
harfbuzz
|
||||
icu
|
||||
libpng
|
||||
gnutls
|
||||
];
|
||||
|
||||
playwrightLinuxSpecificLibs = with pkgs; [
|
||||
glibc
|
||||
libgcc
|
||||
xorg.libX11
|
||||
xorg.libxcb
|
||||
xorg.libXext
|
||||
@ -35,31 +46,23 @@ let
|
||||
xorg.libXi
|
||||
xorg.libXrender
|
||||
xorg.libXtst
|
||||
libxkbcommon
|
||||
mesa
|
||||
libglvnd
|
||||
cairo
|
||||
pango
|
||||
fontconfig
|
||||
freetype
|
||||
harfbuzz
|
||||
libdrm
|
||||
udev
|
||||
alsa-lib
|
||||
icu
|
||||
libdrm
|
||||
libpng
|
||||
gnutls
|
||||
];
|
||||
|
||||
# Path string for LD_LIBRARY_PATH, only for self-downloaded Playwright
|
||||
playwrightSelfDownloadLibs = playwrightCommonLibs ++ (if isLinux then playwrightLinuxSpecificLibs else []);
|
||||
|
||||
playwrightLibPath = pkgs.lib.makeBinPath playwrightSelfDownloadLibs;
|
||||
|
||||
in
|
||||
pkgs.mkShell {
|
||||
buildInputs = commonBuildInputs ++ (
|
||||
if isDarwin
|
||||
then playwrightSelfDownloadLibs
|
||||
else [ pkgs.chromium ]
|
||||
then playwrightCommonLibs
|
||||
else [ pkgs.chromium ] ++ playwrightSelfDownloadLibs
|
||||
);
|
||||
|
||||
shellHook = ''
|
||||
@ -67,9 +70,7 @@ pkgs.mkShell {
|
||||
echo "Node version: $(node --version)"
|
||||
echo "pnpm version: $(pnpm --version)"
|
||||
|
||||
# Conditional setup for Chromium/Playwright
|
||||
${if isDarwin then ''
|
||||
# macOS: Playwright downloads its own browser
|
||||
echo "Chromium path: Playwright will download its own for macOS"
|
||||
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0
|
||||
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=false
|
||||
@ -84,7 +85,6 @@ pkgs.mkShell {
|
||||
echo "✅ Playwright browsers already installed (for macOS)."
|
||||
fi
|
||||
'' else if isLinux then ''
|
||||
# Linux: Use Nixpkgs-provided Chromium
|
||||
echo "Chromium path: ${pkgs.chromium}/bin/chromium"
|
||||
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
||||
export PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH="${pkgs.chromium}/bin/chromium"
|
||||
@ -100,7 +100,6 @@ pkgs.mkShell {
|
||||
fi
|
||||
'';
|
||||
|
||||
# Environment variables
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = if isDarwin then "0" else "1";
|
||||
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH = if isDarwin then null else "${pkgs.chromium}/bin/chromium";
|
||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = if isDarwin then "false" else "true";
|
||||
|
Reference in New Issue
Block a user