From a25412306539e7ecefeb0dc81ca9c6e07b87636a Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Mon, 26 May 2025 20:19:04 +0000 Subject: [PATCH] flutter: optimize evaluation of appBuildDeps --- pkgs/development/compilers/flutter/wrapper.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/flutter/wrapper.nix b/pkgs/development/compilers/flutter/wrapper.nix index 57f945477f41..8b5d38393b47 100644 --- a/pkgs/development/compilers/flutter/wrapper.nix +++ b/pkgs/development/compilers/flutter/wrapper.nix @@ -103,11 +103,19 @@ let let # https://discourse.nixos.org/t/handling-transitive-c-dependencies/5942/3 deps = - pkg: - builtins.filter lib.isDerivation ((pkg.buildInputs or [ ]) ++ (pkg.propagatedBuildInputs or [ ])); - collect = pkg: lib.unique ([ pkg ] ++ deps pkg ++ builtins.concatMap collect (deps pkg)); + pkg: lib.filter lib.isDerivation ((pkg.buildInputs or [ ]) ++ (pkg.propagatedBuildInputs or [ ])); + withKey = pkg: { + key = pkg.outPath; + val = pkg; + }; + collect = pkg: lib.map withKey ([ pkg ] ++ deps pkg); in - builtins.concatMap collect appRuntimeDeps; + lib.map (e: e.val) ( + lib.genericClosure { + startSet = lib.map withKey appRuntimeDeps; + operator = item: collect item.val; + } + ); # Some header files and libraries are not properly located by the Flutter SDK. # They must be manually included.