-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
113 lines (105 loc) · 2.91 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# SPDX-FileCopyrightText: 2024 Camden Boren
# SPDX-License-Identifier: GPL-3.0-or-later
{
description = "chat-script Development Environment and Package via Nix Flake";
inputs = {
nixpkgs = {
url = "github:nixos/nixpkgs/nixos-unstable";
};
linux-share = {
url = "https://cdn-media.huggingface.co/frpc-gradio-0.3/frpc_linux_amd64";
flake = false;
};
darwin-share = {
url = "https://cdn-media.huggingface.co/frpc-gradio-0.3/frpc_darwin_arm64";
flake = false;
};
};
outputs =
{
self,
nixpkgs,
linux-share,
darwin-share,
}:
let
supportedSystems = [
"x86_64-linux"
"aarch64-darwin"
];
forEachSupportedSystem =
function:
nixpkgs.lib.genAttrs supportedSystems (
system:
function rec {
pkgs = nixpkgs.legacyPackages.${system}.extend (
import ./overlay.nix { inherit pkgs linux-share darwin-share; }
);
deps =
with pkgs.python312Packages;
[
gradio
langchain
langchain-core
langchain-community
langchain-chroma
langchain-ollama
notify2
tiktoken
]
++ (with pkgs; [
nodejs
]);
}
);
in
{
devShells = forEachSupportedSystem (
{ pkgs, deps }:
{
default = pkgs.mkShell {
packages =
with pkgs;
[
bashInteractive
python312
]
++ (with pkgs.python312Packages; [
coverage
mkdocs
mkdocs-material
mkdocstrings
mkdocstrings-python
mockito
])
++ deps;
ANONYMIZED_TELEMETRY = "False";
shellHook = ''
echo -e "\nchat-script Development Environment via Nix Flake\n"
echo -e "run: python -m src"
echo -e "test: python -m unittest discover"
echo -e "cov: coverage run --source=src,test -m unittest discover"
echo -e "docs: mkdocs build, serve, or gh-deploy\n"
python --version
'';
};
}
);
packages = forEachSupportedSystem (
{ pkgs, deps }:
{
default = pkgs.python312Packages.buildPythonApplication {
pname = "chat-script";
version = "1.0";
src = ./.;
propagatedBuildInputs = deps;
ANONYMIZED_TELEMETRY = "False";
meta = {
description = "Chat locally with scripts (documents) of your choice with this simple python app.";
maintainers = [ "camdenboren" ];
};
};
}
);
};
}