-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
67 lines (59 loc) · 1.84 KB
/
Copy pathflake.nix
File metadata and controls
67 lines (59 loc) · 1.84 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
{
description = "A robust development environment for Python with Playwright for the web2llm project.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs = { self, nixpkgs }:
let
# Define supported systems to make the flake portable.
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
# Generate outputs for each supported system.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Define the package set for a given system.
pkgsFor = system: import nixpkgs {
inherit system;
config = {
# Allow Nix to fetch unfree browser binaries for Playwright.
allowUnfree = true;
};
};
in
{
# Generate a devShell for each supported system.
devShell = forAllSystems (system:
let
pkgs = pkgsFor system;
pythonWithProjectDeps = pkgs.python3.withPackages (ps: with ps; [
playwright
beautifulsoup4
lxml
markdownify
gitpython
pdfplumber
pyyaml
pathspec
httpx
pytest
pytest-mock
pytest-asyncio
]);
in
pkgs.mkShell {
packages = with pkgs; [
pythonWithProjectDeps
playwright-driver
ruff
pre-commit
git
];
PLAYWRIGHT_BROWSERS_PATH = "${pkgs.playwright-driver.browsers}";
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1";
shellHook = ''
echo "Nix-managed Python dev environment for 'web2llm' on ${system} active."
export PYTHONPATH=$PWD:$PYTHONPATH
alias web2llm="python -m web2llm.cli"
echo "Use 'web2llm' to run from source."
'';
});
};
}