Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

lib.filesystem.listFilesRecursive: only flatten once

Eman Resu ca59048a 3b837fa8

Changed files
+9 -10
lib
+9 -10
lib/filesystem.nix
··· 239 239 ``` 240 240 */ 241 241 listFilesRecursive = 242 - dir: 243 - lib.flatten ( 244 - lib.mapAttrsToList ( 245 - name: type: 246 - if type == "directory" then 247 - lib.filesystem.listFilesRecursive (dir + "/${name}") 248 - else 249 - dir + "/${name}" 250 - ) (builtins.readDir dir) 251 - ); 242 + let 243 + # We only flatten at the very end, as flatten is recursive. 244 + internalFunc = 245 + dir: 246 + (lib.mapAttrsToList ( 247 + name: type: if type == "directory" then internalFunc (dir + "/${name}") else dir + "/${name}" 248 + ) (builtins.readDir dir)); 249 + in 250 + dir: lib.flatten (internalFunc dir); 252 251 253 252 /** 254 253 Transform a directory tree containing package files suitable for