This nix flake provides a way to install Playwright and its browsers in a nixOS system. It does not contain playwright-python, because for my personal use I don't need it and it sometimes lags behind the latest version of playwright.
Important
All versions up to 1.57.0 were published earlier with a now deprecated CDN url. These versions still work, but on 1 december 2025 all tags were retagged to use the new CDN url. If you used this flake before that date, please run nix flake update to get the updated version of whichever version of Playwright you were using.
See the nix shell example if all you need is access to the playwright binary in the current shell.
If you intend to run a test suite:
- See the
nix developexample if the codebase you're working in does not already have aflake.nix, and you don't want to add one. - If the codebase already uses a flake.nix, adapt it like the flake.nix shown below.
Get access to the playwright binary in the current shell.
nix shell github:pietdevries94/playwright-web-flake#playwright-test
which playwright && playwright --version && playwright open nixos.orgGets access to the playwright binary in the current shell and sets some playwright environment variables.
nix develop github:pietdevries94/playwright-web-flake
which playwright && playwright --version && playwright open nixos.org- Create a flake.nix with the content shown below.
- Enter the devshell with
nix develop.
{
description = "Playwright development environment";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.playwright.url = "github:pietdevries94/playwright-web-flake";
outputs = { self, flake-utils, nixpkgs, playwright }:
flake-utils.lib.eachDefaultSystem (system:
let
overlay = final: prev: {
inherit (playwright.packages.${system}) playwright-test playwright-driver;
};
pkgs = import nixpkgs {
inherit system;
overlays = [ overlay ];
};
in
{
devShells = {
default = pkgs.mkShell {
packages = [
pkgs.playwright-test
];
shellHook = ''
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
export PLAYWRIGHT_BROWSERS_PATH="${pkgs.playwright-driver.browsers}"
'';
};
};
});
}The update workflow tags the commit with the version of playwright that is installed. This version can be used to checkout the commit that installed that version of playwright, to match your environment.
The list of available versions can be found here.
The flake reference can be modified to specify a custom version.
-inputs.playwright.url = "github:pietdevries94/playwright-web-flake";
+inputs.playwright.url = "github:pietdevries94/playwright-web-flake/1.37.1";-nix develop github:pietdevries94/playwright-web-flake
+nix develop github:pietdevries94/playwright-web-flake/1.37.1