-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
80 lines (80 loc) · 2.93 KB
/
flake.nix
File metadata and controls
80 lines (80 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
description = "Development environment for Ars Antiqua Online Edition";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
playwright.url = "github:pietdevries94/playwright-web-flake";
};
outputs = { self, nixpkgs, flake-utils, 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 ];
};
buildInputs = with pkgs; [
nodejs_22
pnpm
playwright-test
nodePackages.firebase-tools
nodePackages.http-server
];
commonEnv = {
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1";
PLAYWRIGHT_BROWSERS_PATH = "${pkgs.playwright-driver.browsers}";
};
in
{
devShells.default = pkgs.mkShell {
inherit buildInputs;
shellHook = ''
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=${commonEnv.PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD}
export PLAYWRIGHT_BROWSERS_PATH=${commonEnv.PLAYWRIGHT_BROWSERS_PATH}
'';
};
checks.default = pkgs.runCommand "check-env" {
inherit buildInputs;
inherit (commonEnv) PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD PLAYWRIGHT_BROWSERS_PATH;
} ''
echo "Checking Node.js version..."
if ! node --version | grep -q "v22"; then
echo "Node.js v22 not found. Installed version: $(node --version)"
exit 1
fi
echo "Checking pnpm availability..."
pnpm --version || (echo "pnpm not found" && exit 1)
echo "Checking PLAYWRIGHT_BROWSERS_PATH..."
if [ -z "$PLAYWRIGHT_BROWSERS_PATH" ]; then
echo "PLAYWRIGHT_BROWSERS_PATH is not set"
exit 1
fi
echo "Checking if PLAYWRIGHT_BROWSERS_PATH exists..."
if [ ! -d "$PLAYWRIGHT_BROWSERS_PATH" ]; then
echo "PLAYWRIGHT_BROWSERS_PATH directory does not exist"
exit 1
fi
echo "Checking for specific browsers..."
for browser in chromium firefox webkit; do
if [ ! -d "$PLAYWRIGHT_BROWSERS_PATH/$browser"* ]; then
echo "$browser not found in PLAYWRIGHT_BROWSERS_PATH"
exit 1
fi
done
echo "Checking Firebase tools availability..."
if [ ! -e "${pkgs.nodePackages.firebase-tools}/bin/firebase" ]; then
echo "Firebase tools not found in the expected location"
exit 1
fi
echo "Checking HTTP server availability..."
if [ ! -e "${pkgs.nodePackages.http-server}/bin/http-server" ]; then
echo "HTTP server not found in the expected location"
exit 1
fi
touch $out
'';
}
);
}