Some checks failed
Docker Deploy / build-and-push (push) Has been cancelled
107 lines
2.7 KiB
Nix
107 lines
2.7 KiB
Nix
{ pkgs ? import <nixpkgs> {} }:
|
|
|
|
let
|
|
isDarwin = pkgs.stdenv.isDarwin;
|
|
isLinux = pkgs.stdenv.isLinux;
|
|
|
|
commonBuildInputs = with pkgs; [
|
|
nodejs_24
|
|
nodePackages.pnpm
|
|
git
|
|
curl
|
|
];
|
|
|
|
playwrightCommonLibs = with pkgs; [
|
|
glib
|
|
nss
|
|
nspr
|
|
dbus
|
|
atk
|
|
at-spi2-atk
|
|
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
|
|
xorg.libXfixes
|
|
xorg.libXrandr
|
|
xorg.libXcomposite
|
|
xorg.libXdamage
|
|
xorg.libXcursor
|
|
xorg.libXi
|
|
xorg.libXrender
|
|
xorg.libXtst
|
|
mesa
|
|
libglvnd
|
|
libdrm
|
|
udev
|
|
alsa-lib
|
|
];
|
|
|
|
playwrightSelfDownloadLibs = playwrightCommonLibs ++ (if isLinux then playwrightLinuxSpecificLibs else []);
|
|
|
|
playwrightLibPath = pkgs.lib.makeBinPath playwrightSelfDownloadLibs;
|
|
|
|
in
|
|
pkgs.mkShell {
|
|
buildInputs = commonBuildInputs ++ (
|
|
if isDarwin
|
|
then playwrightCommonLibs
|
|
else [ pkgs.chromium ] ++ playwrightSelfDownloadLibs
|
|
);
|
|
|
|
shellHook = ''
|
|
echo "🚀 atridotdad development environment loaded!"
|
|
echo "Node version: $(node --version)"
|
|
echo "pnpm version: $(pnpm --version)"
|
|
|
|
${if isDarwin then ''
|
|
echo "Chromium path: Playwright will download its own for macOS"
|
|
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0
|
|
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=false
|
|
|
|
export LD_LIBRARY_PATH="${playwrightLibPath}:$LD_LIBRARY_PATH"
|
|
|
|
PLAYWRIGHT_BROWSERS_PATH="$HOME/.cache/ms-playwright"
|
|
if [ ! -d "$PLAYWRIGHT_BROWSERS_PATH" ] || [ -z "$(ls -A "$PLAYWRIGHT_BROWSERS_PATH")" ]; then
|
|
echo "🌐 Installing Playwright browsers (for macOS)..."
|
|
pnpm exec playwright install
|
|
else
|
|
echo "✅ Playwright browsers already installed (for macOS)."
|
|
fi
|
|
'' else if isLinux then ''
|
|
echo "Chromium path: ${pkgs.chromium}/bin/chromium"
|
|
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
|
export PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH="${pkgs.chromium}/bin/chromium"
|
|
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
|
export PUPPETEER_EXECUTABLE_PATH="${pkgs.chromium}/bin/chromium"
|
|
'' else ''
|
|
echo "Unsupported OS detected."
|
|
''}
|
|
|
|
if [ ! -d "node_modules" ]; then
|
|
echo "📦 Installing pnpm dependencies..."
|
|
pnpm install
|
|
fi
|
|
'';
|
|
|
|
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";
|
|
PUPPETEER_EXECUTABLE_PATH = if isDarwin then null else "${pkgs.chromium}/bin/chromium";
|
|
} |