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 2ed266af2905..000000000000 --- a/pkgs/by-name/ai/aider-chat/package.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - python3Packages, - withPlaywright ? false, -}: - -if withPlaywright then - python3Packages.toPythonApplication python3Packages.aider-chat.passthru.withPlaywright -else - python3Packages.toPythonApplication python3Packages.aider-chat diff --git a/pkgs/development/python-modules/aider-chat/default.nix b/pkgs/development/python-modules/aider-chat/default.nix index 76f8e414febb..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 = '' @@ -177,25 +190,73 @@ let pyee typing-extensions ]; + browser = [ + streamlit + ]; + help = [ + llama-index-core + llama-index-embeddings-huggingface + torch + nltk + ]; + bedrock = [ + boto3 + ]; }; passthru = { - withPlaywright = aider-chat.overridePythonAttrs ( + withOptional = { - dependencies, - makeWrapperArgs, - propagatedBuildInputs ? [ ], + withPlaywright ? false, + withBrowser ? false, + withHelp ? false, + withBedrock ? 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 [ ]; + bedrockDeps = if withBedrock || withAll then aider-chat.optional-dependencies.bedrock else [ ]; + + 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 + [ ]; + helpArgs = + if withHelp || withAll then + [ + "--set" + "NLTK_DATA" + "${aider-nltk-data}" + ] + else + [ ]; + in + { + dependencies = dependencies ++ playwrightDeps ++ browserDeps ++ helpDeps ++ bedrockDeps; + propagatedBuildInputs = propagatedBuildInputs ++ playwrightInputs; + makeWrapperArgs = makeWrapperArgs ++ playwrightArgs ++ helpArgs; + } + ); }; meta = { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 30280ebb977d..7bef38df1bed 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 {