Skip to content

Commit

Permalink
build: use explicit playwright version in flake
Browse files Browse the repository at this point in the history
  • Loading branch information
raphiz committed Dec 11, 2024
1 parent c49070e commit 580a044
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 10 deletions.
78 changes: 73 additions & 5 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 12 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@
description = "Pixelpact Project Flake";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
flake-utils.url = "github:numtide/flake-utils";
playwright.url = "github:pietdevries94/playwright-web-flake/1.48.2";
};

outputs = {
nixpkgs,
flake-utils,
playwright,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
overlay = final: prev: {
inherit (playwright.packages.${system}) playwright-test playwright-driver;
};
pkgs = import nixpkgs {
inherit system;
overlays = [overlay];
};
nodejs = pkgs.nodejs_20;
start-server = pkgs.writeShellScriptBin "start-server" ''cd $REPOSITORY_ROOT/pixelpact; npm run start'';
start-server-docker = pkgs.writeShellScriptBin "start-server-docker" ''cd $REPOSITORY_ROOT/pixelpact; docker compose up --build'';
Expand All @@ -21,10 +29,9 @@
buildInputs = with pkgs; [nodejs start-server start-server-docker];
shellHook = ''
export REPOSITORY_ROOT=$(pwd)
playwright_chromium_revision="$(${pkgs.jq}/bin/jq --raw-output '.browsers[] | select(.name == "chromium").revision' ${pkgs.playwright-driver}/package/browsers.json)"
export PLAYWRIGHT_CHROME_EXECUTABLE_PATH="${pkgs.playwright-driver.browsers}/chromium-$playwright_chromium_revision/chrome-linux/chrome";
export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers}
export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS
export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=true
ln -fs "$REPOSITORY_ROOT/bin/pre-commit" "$REPOSITORY_ROOT/.git/hooks/pre-commit"
'';
};
Expand Down

0 comments on commit 580a044

Please sign in to comment.