From af8e89f687def3387d762faea61e125d1f649ed7 Mon Sep 17 00:00:00 2001 From: Zexin Yuan Date: Sun, 6 Apr 2025 12:59:44 +0800 Subject: [PATCH] aider-chat: delaying evaluation of optional conditionals --- .../python-modules/aider-chat/default.nix | 58 +++++++++---------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/pkgs/development/python-modules/aider-chat/default.nix b/pkgs/development/python-modules/aider-chat/default.nix index a75c32980109..7e1852916966 100644 --- a/pkgs/development/python-modules/aider-chat/default.nix +++ b/pkgs/development/python-modules/aider-chat/default.nix @@ -330,40 +330,34 @@ let 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; + dependencies = + dependencies + ++ lib.optionals (withAll || withPlaywright) aider-chat.optional-dependencies.playwright + ++ lib.optionals (withAll || withBrowser) aider-chat.optional-dependencies.browser + ++ lib.optionals (withAll || withHelp) aider-chat.optional-dependencies.help + ++ lib.optionals (withAll || withBedrock) aider-chat.optional-dependencies.bedrock; + + propagatedBuildInputs = + propagatedBuildInputs + ++ lib.optionals (withAll || withPlaywright) [ playwright-driver.browsers ]; + + makeWrapperArgs = + makeWrapperArgs + ++ lib.optionals (withAll || withPlaywright) [ + "--set" + "PLAYWRIGHT_BROWSERS_PATH" + "${playwright-driver.browsers}" + "--set" + "PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS" + "true" + ] + ++ lib.optionals (withAll || withHelp) [ + "--set" + "NLTK_DATA" + "${aider-nltk-data}" + ]; } );