feat: add NixOS Playwright support with system Chrome via flake devShell
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
};
|
||||
|
||||
outputs =
|
||||
inputs@{ flake-parts, ... }:
|
||||
inputs@{ flake-parts, nixpkgs, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
@@ -25,8 +25,15 @@
|
||||
];
|
||||
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{ system, pkgs, ... }:
|
||||
{
|
||||
_module.args = {
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
};
|
||||
|
||||
treefmt = {
|
||||
projectRootFile = "flake.nix";
|
||||
programs = {
|
||||
@@ -41,10 +48,19 @@
|
||||
uv
|
||||
ruff
|
||||
pyright
|
||||
google-chrome
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export UV_PYTHON_PREFERENCE=only-system
|
||||
export UV_PYTHON_PREFERENCE=managed
|
||||
|
||||
# Set Playwright browser path (prefer system Chrome, fallback to nixpkg)
|
||||
if [ -f /run/current-system/sw/bin/google-chrome ]; then
|
||||
export PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/run/current-system/sw/bin/google-chrome
|
||||
else
|
||||
export PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=${pkgs.google-chrome}/bin/google-chrome
|
||||
fi
|
||||
export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user