1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 replaceVars,
7 gitMinimal,
8 portaudio,
9 playwright-driver,
10 pythonOlder,
11 pythonAtLeast,
12 setuptools-scm,
13 aiohappyeyeballs,
14 aiohttp,
15 aiosignal,
16 annotated-types,
17 anyio,
18 attrs,
19 backoff,
20 beautifulsoup4,
21 cachetools,
22 certifi,
23 cffi,
24 charset-normalizer,
25 click,
26 configargparse,
27 diff-match-patch,
28 diskcache,
29 distro,
30 filelock,
31 flake8,
32 frozenlist,
33 fsspec,
34 gitdb,
35 gitpython,
36 google-ai-generativelanguage,
37 google-generativeai,
38 grep-ast,
39 h11,
40 hf-xet,
41 httpcore,
42 httpx,
43 huggingface-hub,
44 idna,
45 importlib-resources,
46 jinja2,
47 jiter,
48 json5,
49 jsonschema,
50 jsonschema-specifications,
51 litellm,
52 markdown-it-py,
53 markupsafe,
54 mccabe,
55 mdurl,
56 multidict,
57 networkx,
58 numpy,
59 openai,
60 oslex,
61 packaging,
62 pathspec,
63 pexpect,
64 pillow,
65 prompt-toolkit,
66 psutil,
67 ptyprocess,
68 pycodestyle,
69 pycparser,
70 pydantic,
71 pydantic-core,
72 pydub,
73 pyflakes,
74 pygments,
75 pypandoc,
76 pyperclip,
77 python-dotenv,
78 pyyaml,
79 referencing,
80 regex,
81 requests,
82 rich,
83 rpds-py,
84 scipy,
85 shtab,
86 smmap,
87 sniffio,
88 sounddevice,
89 socksio,
90 soundfile,
91 soupsieve,
92 tiktoken,
93 tokenizers,
94 tqdm,
95 tree-sitter,
96 tree-sitter-language-pack,
97 typing-extensions,
98 typing-inspection,
99 urllib3,
100 watchfiles,
101 wcwidth,
102 yarl,
103 zipp,
104 pip,
105 mixpanel,
106 monotonic,
107 posthog,
108 propcache,
109 python-dateutil,
110 pytestCheckHook,
111 greenlet,
112 playwright,
113 pyee,
114 streamlit,
115 llama-index-core,
116 llama-index-embeddings-huggingface,
117 torch,
118 nltk,
119 boto3,
120 nix-update-script,
121}:
122
123let
124 aider-nltk-data = nltk.dataDir (d: [
125 d.punkt-tab
126 d.stopwords
127 ]);
128
129 version = "0.84.0";
130 aider-chat = buildPythonPackage {
131 pname = "aider-chat";
132 inherit version;
133 pyproject = true;
134
135 # dont support python 3.13 (Aider-AI/aider#3037)
136 disabled = pythonOlder "3.10" || pythonAtLeast "3.13";
137
138 src = fetchFromGitHub {
139 owner = "Aider-AI";
140 repo = "aider";
141 tag = "v${version}";
142 hash = "sha256-TOlqwJM9wIAURSimuh9mysYDwgH9AfFev8jY9elLNk8=";
143 };
144
145 pythonRelaxDeps = true;
146
147 build-system = [ setuptools-scm ];
148
149 dependencies = [
150 aiohappyeyeballs
151 aiohttp
152 aiosignal
153 annotated-types
154 anyio
155 attrs
156 backoff
157 beautifulsoup4
158 cachetools
159 certifi
160 cffi
161 charset-normalizer
162 click
163 configargparse
164 diff-match-patch
165 diskcache
166 distro
167 filelock
168 flake8
169 frozenlist
170 fsspec
171 gitdb
172 gitpython
173 google-ai-generativelanguage
174 google-generativeai
175 grep-ast
176 h11
177 hf-xet
178 httpcore
179 httpx
180 huggingface-hub
181 idna
182 importlib-resources
183 jinja2
184 jiter
185 json5
186 jsonschema
187 jsonschema-specifications
188 litellm
189 markdown-it-py
190 markupsafe
191 mccabe
192 mdurl
193 multidict
194 networkx
195 numpy
196 openai
197 oslex
198 packaging
199 pathspec
200 pexpect
201 pillow
202 prompt-toolkit
203 psutil
204 ptyprocess
205 pycodestyle
206 pycparser
207 pydantic
208 pydantic-core
209 pydub
210 pyflakes
211 pygments
212 pypandoc
213 pyperclip
214 python-dotenv
215 pyyaml
216 referencing
217 regex
218 requests
219 rich
220 rpds-py
221 scipy
222 shtab
223 smmap
224 sniffio
225 sounddevice
226 socksio
227 soundfile
228 soupsieve
229 tiktoken
230 tokenizers
231 tqdm
232 tree-sitter
233 tree-sitter-language-pack
234 typing-extensions
235 typing-inspection
236 urllib3
237 watchfiles
238 wcwidth
239 yarl
240 zipp
241 pip
242
243 # Not listed in requirements
244 mixpanel
245 monotonic
246 posthog
247 propcache
248 python-dateutil
249 ];
250
251 buildInputs = [ portaudio ];
252
253 nativeCheckInputs = [
254 pytestCheckHook
255 gitMinimal
256 ];
257
258 patches = [
259 (replaceVars ./fix-flake8-invoke.patch {
260 flake8 = lib.getExe flake8;
261 })
262 ];
263
264 disabledTestPaths = [
265 # Tests require network access
266 "tests/scrape/test_scrape.py"
267 # Expected 'mock' to have been called once
268 "tests/help/test_help.py"
269 ];
270
271 disabledTests =
272 [
273 # Tests require network
274 "test_urls"
275 "test_get_commit_message_with_custom_prompt"
276 # FileNotFoundError
277 "test_get_commit_message"
278 # Expected 'launch_gui' to have been called once
279 "test_browser_flag_imports_streamlit"
280 # AttributeError
281 "test_simple_send_with_retries"
282 # Expected 'check_version' to have been called once
283 "test_main_exit_calls_version_check"
284 # AssertionError: assert 2 == 1
285 "test_simple_send_non_retryable_error"
286 ]
287 ++ lib.optionals stdenv.hostPlatform.isDarwin [
288 # Tests fails on darwin
289 "test_dark_mode_sets_code_theme"
290 "test_default_env_file_sets_automatic_variable"
291 # FileNotFoundError: [Errno 2] No such file or directory: 'vim'
292 "test_pipe_editor"
293 ];
294
295 makeWrapperArgs = [
296 "--set"
297 "AIDER_CHECK_UPDATE"
298 "false"
299 "--set"
300 "AIDER_ANALYTICS"
301 "false"
302 ];
303
304 preCheck = ''
305 export HOME=$(mktemp -d)
306 export AIDER_ANALYTICS="false"
307 '';
308
309 optional-dependencies = {
310 playwright = [
311 greenlet
312 playwright
313 pyee
314 typing-extensions
315 ];
316 browser = [
317 streamlit
318 ];
319 help = [
320 llama-index-core
321 llama-index-embeddings-huggingface
322 torch
323 nltk
324 ];
325 bedrock = [
326 boto3
327 ];
328 };
329
330 passthru = {
331 withOptional =
332 {
333 withPlaywright ? false,
334 withBrowser ? false,
335 withHelp ? false,
336 withBedrock ? false,
337 withAll ? false,
338 ...
339 }:
340 aider-chat.overridePythonAttrs (
341 {
342 dependencies,
343 makeWrapperArgs,
344 propagatedBuildInputs ? [ ],
345 ...
346 }:
347
348 {
349 dependencies =
350 dependencies
351 ++ lib.optionals (withAll || withPlaywright) aider-chat.optional-dependencies.playwright
352 ++ lib.optionals (withAll || withBrowser) aider-chat.optional-dependencies.browser
353 ++ lib.optionals (withAll || withHelp) aider-chat.optional-dependencies.help
354 ++ lib.optionals (withAll || withBedrock) aider-chat.optional-dependencies.bedrock;
355
356 propagatedBuildInputs =
357 propagatedBuildInputs
358 ++ lib.optionals (withAll || withPlaywright) [ playwright-driver.browsers ];
359
360 makeWrapperArgs =
361 makeWrapperArgs
362 ++ lib.optionals (withAll || withPlaywright) [
363 "--set"
364 "PLAYWRIGHT_BROWSERS_PATH"
365 "${playwright-driver.browsers}"
366 "--set"
367 "PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS"
368 "true"
369 ]
370 ++ lib.optionals (withAll || withHelp) [
371 "--set"
372 "NLTK_DATA"
373 "${aider-nltk-data}"
374 ];
375 }
376 );
377
378 updateScript = nix-update-script {
379 extraArgs = [
380 "--version-regex"
381 "^v([0-9.]+)$"
382 ];
383 };
384 };
385
386 meta = {
387 description = "AI pair programming in your terminal";
388 homepage = "https://github.com/paul-gauthier/aider";
389 changelog = "https://github.com/paul-gauthier/aider/blob/v${version}/HISTORY.md";
390 license = lib.licenses.asl20;
391 maintainers = with lib.maintainers; [
392 happysalada
393 yzx9
394 ];
395 mainProgram = "aider";
396 };
397 };
398in
399aider-chat