-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
62 lines (56 loc) · 2.23 KB
/
flake.nix
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
{
description = "A collection of oxygen-free tools for astronauts.";
inputs = {
nixpkgs.url = "github:Fryuni/nixpkgs/master";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system: let
throwSystem = throw "Unsupported system: ${system}";
pkgs = nixpkgs.legacyPackages.${system};
node = pkgs.nodejs_20;
browsersInfo = builtins.fromJSON (builtins.readFile "${pkgs.playwright-driver}/browsers.json");
in {
devShells.default = pkgs.mkShell {
packages = [
node
pkgs.corepack_22
];
PLAYWRIGHT_NODEJS_PATH = "${node}/bin/node";
PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = true;
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = 1;
PLAYWRIGHT_BROWSERS_PATH = "${pkgs.playwright-driver.browsers}";
PLAYWRIGHT_CHROME_BIN = let
chromeInfo = pkgs.lib.lists.findFirst (b: b.name == "chromium") (throw "value not found") browsersInfo.browsers;
chromePath =
{
x86_64-linux = "chrome-linux/chrome";
aarch64-linux = "chrome-linux/chrome";
x86_64-darwin = "chrome-mac/Chromium.app/Contents/MacOS/Chromium";
arm64-darwin = "chrome-mac/Chromium.app/Contents/MacOS/Chromium";
}
.${system}
or throwSystem;
in "${pkgs.playwright-driver.browsers}/chromium-${chromeInfo.revision}/${chromePath}";
PLAYWRIGHT_FIREFOX_BIN = let
firefoxInfo = pkgs.lib.lists.findFirst (b: b.name == "firefox") (throw "value not found") browsersInfo.browsers;
firefoxPath =
{
x86_64-linux = "firefox-linux/firefox";
aarch64-linux = "firefox-linux/firefox";
x86_64-darwin = "firefox/Nightly.app/Contents/MacOS/firefox";
arm64-darwin = "firefox/Nightly.app/Contents/MacOS/firefox";
}
.${system}
or throwSystem;
in "${pkgs.playwright-driver.browsers}/firefox-${firefoxInfo.revision}/${firefoxPath}";
};
formatter = pkgs.alejandra;
}
);
}