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