From 9794620a5dd2e6663c1c370aea367ce3defa9c27 Mon Sep 17 00:00:00 2001 From: Chun Yu Date: Wed, 26 Mar 2025 15:16:45 +0800 Subject: [PATCH 1/6] aider-chat: add optional dependencies for help and browser --- pkgs/by-name/ai/aider-chat/package.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/by-name/ai/aider-chat/package.nix b/pkgs/by-name/ai/aider-chat/package.nix index 2ed266af2905..c34ab1173617 100644 --- a/pkgs/by-name/ai/aider-chat/package.nix +++ b/pkgs/by-name/ai/aider-chat/package.nix @@ -1,9 +1,18 @@ { python3Packages, withPlaywright ? false, + withBrowser ? false, + withHelp ? false, + withOptional ? false, }: if withPlaywright then python3Packages.toPythonApplication python3Packages.aider-chat.passthru.withPlaywright +else if withBrowser then + python3Packages.toPythonApplication python3Packages.aider-chat.passthru.withBrowser +else if withHelp then + python3Packages.toPythonApplication python3Packages.aider-chat.passthru.withHelp +else if withOptional then + python3Packages.toPythonApplication python3Packages.aider-chat.passthru.withOptional else python3Packages.toPythonApplication python3Packages.aider-chat From fca131252727c44b34f6b171e718f1b357dda05c Mon Sep 17 00:00:00 2001 From: Chun Yu Date: Wed, 26 Mar 2025 15:16:24 +0800 Subject: [PATCH 2/6] python3Packages.aider-chat: add optional dependencies --- .../python-modules/aider-chat/default.nix | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/pkgs/development/python-modules/aider-chat/default.nix b/pkgs/development/python-modules/aider-chat/default.nix index 76f8e414febb..d4879ed33c9f 100644 --- a/pkgs/development/python-modules/aider-chat/default.nix +++ b/pkgs/development/python-modules/aider-chat/default.nix @@ -177,6 +177,14 @@ let pyee typing-extensions ]; + browser = [ + streamlit + ]; + help = [ + llama-index-core + llama-index-embeddings-huggingface + torch + ]; }; passthru = { @@ -196,6 +204,41 @@ let ]; } ); + + withBrowser = aider-chat.overridePythonAttrs ( + { dependencies, ... }: + { + dependencies = dependencies ++ aider-chat.optional-dependencies.browser; + } + ); + + withHelp = aider-chat.overridePythonAttrs ( + { dependencies, ... }: + { + dependencies = dependencies ++ aider-chat.optional-dependencies.help; + } + ); + + withOptional = aider-chat.overridePythonAttrs ( + { + dependencies, + makeWrapperArgs, + propagatedBuildInputs ? [ ], + ... + }: + { + dependencies = + dependencies + ++ aider-chat.optional-dependencies.playwright + ++ aider-chat.optional-dependencies.browser + ++ aider-chat.optional-dependencies.help; + propagatedBuildInputs = propagatedBuildInputs ++ [ playwright-driver.browsers ]; + makeWrapperArgs = makeWrapperArgs ++ [ + "--set PLAYWRIGHT_BROWSERS_PATH ${playwright-driver.browsers}" + "--set PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true" + ]; + } + ); }; meta = { From fefeed987af810fd92a8cb3463647411aaf57be4 Mon Sep 17 00:00:00 2001 From: Chun Yu Date: Fri, 28 Mar 2025 01:52:31 +0800 Subject: [PATCH 3/6] python3Packages.aider-chat: made withOptional a function with parameters --- .../python-modules/aider-chat/default.nix | 80 ++++++++----------- 1 file changed, 33 insertions(+), 47 deletions(-) diff --git a/pkgs/development/python-modules/aider-chat/default.nix b/pkgs/development/python-modules/aider-chat/default.nix index d4879ed33c9f..d02baf5434dc 100644 --- a/pkgs/development/python-modules/aider-chat/default.nix +++ b/pkgs/development/python-modules/aider-chat/default.nix @@ -188,57 +188,43 @@ let }; passthru = { - withPlaywright = aider-chat.overridePythonAttrs ( + withOptional = { - dependencies, - makeWrapperArgs, - propagatedBuildInputs ? [ ], + withPlaywright ? false, + withBrowser ? false, + withHelp ? false, + withAll ? false, ... }: - { - dependencies = dependencies ++ aider-chat.optional-dependencies.playwright; - propagatedBuildInputs = propagatedBuildInputs ++ [ playwright-driver.browsers ]; - makeWrapperArgs = makeWrapperArgs ++ [ - "--set PLAYWRIGHT_BROWSERS_PATH ${playwright-driver.browsers}" - "--set PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true" - ]; - } - ); + aider-chat.overridePythonAttrs ( + { + dependencies, + makeWrapperArgs, + propagatedBuildInputs ? [ ], + ... + }: + let + playwrightDeps = + if withPlaywright || withAll then aider-chat.optional-dependencies.playwright else [ ]; + browserDeps = if withBrowser || withAll then aider-chat.optional-dependencies.browser else [ ]; + helpDeps = if withHelp || withAll then aider-chat.optional-dependencies.help else [ ]; - withBrowser = aider-chat.overridePythonAttrs ( - { dependencies, ... }: - { - dependencies = dependencies ++ aider-chat.optional-dependencies.browser; - } - ); - - withHelp = aider-chat.overridePythonAttrs ( - { dependencies, ... }: - { - dependencies = dependencies ++ aider-chat.optional-dependencies.help; - } - ); - - withOptional = aider-chat.overridePythonAttrs ( - { - dependencies, - makeWrapperArgs, - propagatedBuildInputs ? [ ], - ... - }: - { - dependencies = - dependencies - ++ aider-chat.optional-dependencies.playwright - ++ aider-chat.optional-dependencies.browser - ++ aider-chat.optional-dependencies.help; - propagatedBuildInputs = propagatedBuildInputs ++ [ playwright-driver.browsers ]; - makeWrapperArgs = makeWrapperArgs ++ [ - "--set PLAYWRIGHT_BROWSERS_PATH ${playwright-driver.browsers}" - "--set PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true" - ]; - } - ); + playwrightInputs = if withPlaywright || withAll then [ playwright-driver.browsers ] else [ ]; + playwrightArgs = + if withPlaywright || withAll then + [ + "--set PLAYWRIGHT_BROWSERS_PATH ${playwright-driver.browsers}" + "--set PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true" + ] + else + [ ]; + in + { + dependencies = dependencies ++ playwrightDeps ++ browserDeps ++ helpDeps; + propagatedBuildInputs = propagatedBuildInputs ++ playwrightInputs; + makeWrapperArgs = makeWrapperArgs ++ playwrightArgs; + } + ); }; meta = { From b54f01f1c069ad8f070e552ca00778c0a1a99aff Mon Sep 17 00:00:00 2001 From: Chun Yu Date: Fri, 28 Mar 2025 01:55:58 +0800 Subject: [PATCH 4/6] python3Packages.aider-chat: add bedrock optional dependencies --- pkgs/development/python-modules/aider-chat/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/aider-chat/default.nix b/pkgs/development/python-modules/aider-chat/default.nix index d02baf5434dc..7fc8ac807754 100644 --- a/pkgs/development/python-modules/aider-chat/default.nix +++ b/pkgs/development/python-modules/aider-chat/default.nix @@ -185,6 +185,9 @@ let llama-index-embeddings-huggingface torch ]; + bedrock = [ + boto3 + ]; }; passthru = { @@ -193,6 +196,7 @@ let withPlaywright ? false, withBrowser ? false, withHelp ? false, + withBedrock ? false, withAll ? false, ... }: @@ -208,6 +212,7 @@ let if withPlaywright || withAll then aider-chat.optional-dependencies.playwright else [ ]; browserDeps = if withBrowser || withAll then aider-chat.optional-dependencies.browser else [ ]; helpDeps = if withHelp || withAll then aider-chat.optional-dependencies.help else [ ]; + bedrockDeps = if withBedrock || withAll then aider-chat.optional-dependencies.bedrock else [ ]; playwrightInputs = if withPlaywright || withAll then [ playwright-driver.browsers ] else [ ]; playwrightArgs = @@ -220,7 +225,7 @@ let [ ]; in { - dependencies = dependencies ++ playwrightDeps ++ browserDeps ++ helpDeps; + dependencies = dependencies ++ playwrightDeps ++ browserDeps ++ helpDeps ++ bedrockDeps; propagatedBuildInputs = propagatedBuildInputs ++ playwrightInputs; makeWrapperArgs = makeWrapperArgs ++ playwrightArgs; } From 7cce75a6f3ba79802a2189e33ee2fe33e27094dd Mon Sep 17 00:00:00 2001 From: Chun Yu Date: Tue, 1 Apr 2025 02:06:15 +0800 Subject: [PATCH 5/6] python3Packages.aider-chat: add additional dependencies for help --- .../python-modules/aider-chat/default.nix | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/aider-chat/default.nix b/pkgs/development/python-modules/aider-chat/default.nix index 7fc8ac807754..08771cbb23e4 100644 --- a/pkgs/development/python-modules/aider-chat/default.nix +++ b/pkgs/development/python-modules/aider-chat/default.nix @@ -6,9 +6,18 @@ gitMinimal, portaudio, playwright-driver, + symlinkJoin, + nltk-data, }: let + aider-nltk-data = symlinkJoin { + name = "aider-nltk-data"; + paths = [ + nltk-data.punkt_tab + nltk-data.stopwords + ]; + }; python3 = python312.override { self = python3; packageOverrides = _: super: { tree-sitter = super.tree-sitter_0_21; }; @@ -161,8 +170,12 @@ let ]; makeWrapperArgs = [ - "--set AIDER_CHECK_UPDATE false" - "--set AIDER_ANALYTICS false" + "--set" + "AIDER_CHECK_UPDATE" + "false" + "--set" + "AIDER_ANALYTICS" + "false" ]; preCheck = '' @@ -184,6 +197,7 @@ let llama-index-core llama-index-embeddings-huggingface torch + nltk ]; bedrock = [ boto3 @@ -218,8 +232,21 @@ let playwrightArgs = if withPlaywright || withAll then [ - "--set PLAYWRIGHT_BROWSERS_PATH ${playwright-driver.browsers}" - "--set PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true" + "--set" + "PLAYWRIGHT_BROWSERS_PATH" + "${playwright-driver.browsers}" + "--set" + "PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS" + "true" + ] + else + [ ]; + helpArgs = + if withHelp || withAll then + [ + "--set" + "NLTK_DATA" + "${aider-nltk-data}" ] else [ ]; @@ -227,7 +254,7 @@ let { dependencies = dependencies ++ playwrightDeps ++ browserDeps ++ helpDeps ++ bedrockDeps; propagatedBuildInputs = propagatedBuildInputs ++ playwrightInputs; - makeWrapperArgs = makeWrapperArgs ++ playwrightArgs; + makeWrapperArgs = makeWrapperArgs ++ playwrightArgs ++ helpArgs; } ); }; From 2164766ad2a58af4fe4274a7948c8dda1d0fc5cc Mon Sep 17 00:00:00 2001 From: Chun Yu Date: Tue, 1 Apr 2025 02:06:37 +0800 Subject: [PATCH 6/6] aider-chat: refactor aider-chat to all-packages, add variants --- pkgs/by-name/ai/aider-chat/package.nix | 18 ------------------ pkgs/top-level/all-packages.nix | 12 ++++++++++++ 2 files changed, 12 insertions(+), 18 deletions(-) delete mode 100644 pkgs/by-name/ai/aider-chat/package.nix diff --git a/pkgs/by-name/ai/aider-chat/package.nix b/pkgs/by-name/ai/aider-chat/package.nix deleted file mode 100644 index c34ab1173617..000000000000 --- a/pkgs/by-name/ai/aider-chat/package.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - python3Packages, - withPlaywright ? false, - withBrowser ? false, - withHelp ? false, - withOptional ? false, -}: - -if withPlaywright then - python3Packages.toPythonApplication python3Packages.aider-chat.passthru.withPlaywright -else if withBrowser then - python3Packages.toPythonApplication python3Packages.aider-chat.passthru.withBrowser -else if withHelp then - python3Packages.toPythonApplication python3Packages.aider-chat.passthru.withHelp -else if withOptional then - python3Packages.toPythonApplication python3Packages.aider-chat.passthru.withOptional -else - python3Packages.toPythonApplication python3Packages.aider-chat diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 057c6c48359c..dc51f850668a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -170,6 +170,18 @@ with pkgs; } ../build-support/setup-hooks/add-bin-to-path.sh ) { }; + aider-chat = with python3Packages; toPythonApplication aider-chat; + + aider-chat-with-playwright = with python3Packages; toPythonApplication (aider-chat.withOptional { withPlaywright = true; }); + + aider-chat-with-browser = with python3Packages; toPythonApplication (aider-chat.withOptional { withBrowser = true; }); + + aider-chat-with-help = with python3Packages; toPythonApplication (aider-chat.withOptional { withHelp = true; }); + + aider-chat-with-bedrock = with python3Packages; toPythonApplication (aider-chat.withOptional { withBedrock = true; }); + + aider-chat-full = with python3Packages; toPythonApplication (aider-chat.withOptional { withAll = true; }); + autoreconfHook = callPackage ( { makeSetupHook, autoconf, automake, gettext, libtool }: makeSetupHook {