I’m glad my comment was helpful!
If you’re having trouble finding the nixpkgs’s commit in which the desired playwright version you might find it useful nixhub
How I use it:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs-pw-v1_40.url = "github:nixos/nixpkgs/0a254180b4cad6be45aa46dce896bdb8db5d2930";
};
outputs = { self, nixpkgs, nixpkgs-pw-v1_40 }: let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
pkgs-pw-v1_40 = import nixpkgs-pw-v1_40 { inherit system; };
in {
devShells.${system}.default = pkgs.mkShell {
packages = [
pkgs.nodejs_20
pkgs-pw-v1_40.playwright
];
PLAYWRIGHT_NODEJS_PATH = "${pkgs.nodejs_20}/bin/node";
PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = true;
PLAYWRIGHT_BROWSERS_PATH="${pkgs-pw-v1_40.playwright-driver.browsers}";
};
};
}
For example: if I need to use pw 1.38 instead 1.40, I’ll just use commit a71323f68d4377d12c04a5410e214495ec598d4c (found it on nixhub).
What would need to change to make this work with direnv?
My .envrc in project folder:
if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4="
fi
use flake /src/flakes/flake-for-this-project
I store flakes separately from projects (/src/flakes/*), but of course it’s easier to keep them in a project.