feat: add NixOS Playwright support with system Chrome via flake devShell
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
inputs@{ flake-parts, ... }:
|
inputs@{ flake-parts, nixpkgs, ... }:
|
||||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
systems = [
|
systems = [
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
@@ -25,8 +25,15 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
perSystem =
|
perSystem =
|
||||||
{ pkgs, ... }:
|
{ system, pkgs, ... }:
|
||||||
{
|
{
|
||||||
|
_module.args = {
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
treefmt = {
|
treefmt = {
|
||||||
projectRootFile = "flake.nix";
|
projectRootFile = "flake.nix";
|
||||||
programs = {
|
programs = {
|
||||||
@@ -41,10 +48,19 @@
|
|||||||
uv
|
uv
|
||||||
ruff
|
ruff
|
||||||
pyright
|
pyright
|
||||||
|
google-chrome
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
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