nix-playwright
/nix-playwright
Use this when adding Nix-based local runs for an existing Playwright e2e suite. Provides a self-contained `tests/shell.nix` that uses `nixpkgs-latest` for `playwright-driver.browsers`, plus a justfile entry — works on NixOS where `npx playwright install --with-deps` cannot.
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 1
No signals detected. Repository changed on 21.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use this when adding Nix-based local runs for an existing Playwright e2e suite. Provides a self-contained `tests/shell.nix` that uses `nixpkgs-latest` for `playwright-driver.browsers`, plus a justfile entry — works on NixOS where `npx playwright install --with-deps` cannot.
Original author description
Use this when adding Nix-based local runs for an existing Playwright e2e suite. Provides a self-contained `tests/shell.nix` that uses `nixpkgs-latest` for `playwright-driver.browsers`, plus a justfile entry — works on NixOS where `npx playwright install --with-deps` cannot.
How it works
- Add a nixpkgs-latest flake input
- tests/shell.nix
- Justfile recipe
- Critical version constraint
- Reference
SKILL.md preview
---
name: nix-playwright
description: Use this when adding Nix-based local runs for an existing Playwright e2e suite. Provides a self-contained `tests/shell.nix` that uses `nixpkgs-latest` for `playwright-driver.browsers`, plus a justfile entry — works on NixOS where `npx playwright install --with-deps` cannot.
---
# Playwright e2e under Nix
For projects that already have a Playwright e2e suite (typically under `tests/`) and need it to run locally on NixOS / pure-Nix hosts, where Playwright's bundled Chromium download depends on `apt-get` + `sudo`.
GitHub Actions CI is left untouched — apt-provided Chromium on Ubuntu runners is cheaper than spinning up a Nix devshell. This skill is for **local** runs (and Nix-based CI like Vira); GHA continues to use its own apt path.
## Add a `nixpkgs-latest` flake input
In top-level `flake.nix`, add an independent pin so the Playwright rev moves on its own cadence (decoupled from the main `nixpkgs` your build uses):
```nix
inputs.nixpkgs-latest.url = "github:nixos/nixpkgs/nixpkgs-unstable";
```
## `tests/shell.nix`
Self-contained. Reads the parent flake's lock to resolve `nixpkgs-latest` without needing a flake context:
```nix
let
lock = builtins.fromJSON (builtins.readFile ../flake.lock);
nixpkgsLocked = lock.nodes.nixpkgs-latest.locked;
pkgs = import (builtins.fetchTree {
type = "github";
inherit (nixpkgsLocked) owner repo rev narHash;
}) { };
in
pkgs.mkShell {
packages = [ pkgs.nodejs ];
PLAYWRIGHT_BROWSERS_PATH = "${pkgs.playwright-driver.browsers}";
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1";
}
```
## Justfile recipe
```just
e2e:
nix-shell tests/shell.nix --run "cd tests && { [ -d node_modules ] || npm ci; } && npm test"
```
## Critical version constraint
`pkgs.playwright-driver` version must match the `playwright` version in `tests/package.json`. Drift raises **"browser revision X not found at <PLAYWRIGHT_BROWSERS_PATH>"** at launch.
Bump both together:
1. `nix flake update nixpkgs-latest`
2. Match `playwright` in `tests/package.json` to the new driver version
3. `npm install` in `tests/` to regenerate the lockfile
## Reference
Pattern extracted from [emanote#660](https://github.com/srid/emanote/pull/660).
Versions
The database has no other skills named nix-playwright.
Database snapshot: 13.11.2026 · package version 27c70c6fcf3f (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100nixos
NixOS and Nix: configuration.nix, flakes, nixos-rebuild, Home Manager, nix-darwin, overlays, dev shells, sops-nix. Use for failing rebuilds, rollbacks. - 100nix-lab
Write or change a self-contained Nix flake lab: a toolchain or dev shell that other repositories use. Covers locks, Rust tools, a just 1.21 justfile and the local gate. Use for flake.nix, devShells or a new lab. - 100ultimate-nixos
Comprehensive Nix ecosystem guidance covering NixOS system configuration, nixpkgs packaging and maintainer workflow, nix-darwin macOS management, Home Manager, flakes, derivations, NixOS module design, security hardening, and community processes. Use when writing Nix… - 96nix
Write and review Nix code. Use when a task touches a `.nix` file. - 90nix-tool-policy
Use when installing or choosing CLI tools in a Nix flake repo, editing flake.nix or home-manager config, or when tempted to pip/pipx/uv/brew/npm install anything. Tools come from the dev shell or nix shell — never ad-hoc package managers. - 100nix
Use when working with Nix code, flakes, derivations, overlays, NixOS, Home Manager, or nix-darwin modules.