Skip to content

Commit 065b480

Browse files
committed
lib.packagesFromDirectoryRecursive: let-bind functions called from lib
I was told it is better for eval performance: #361424 (comment)
1 parent 1db8650 commit 065b480

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/filesystem.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,14 @@ in
364364
...
365365
}:
366366
let
367+
inherit (lib) concatMapAttrs removeSuffix;
367368
inherit (lib.path) append;
368369
defaultPath = append directory "package.nix";
369370
in
370371
if pathExists defaultPath then
371372
# if `${directory}/package.nix` exists, call it directly
372373
callPackage defaultPath {}
373-
else lib.concatMapAttrs (name: type:
374+
else concatMapAttrs (name: type:
374375
# otherwise, for each directory entry
375376
let path = append directory name; in
376377
if type == "directory" then {
@@ -381,7 +382,7 @@ in
381382
};
382383
} else if type == "regular" && hasSuffix ".nix" name then {
383384
# call .nix files
384-
"${lib.removeSuffix ".nix" name}" = callPackage path {};
385+
"${removeSuffix ".nix" name}" = callPackage path {};
385386
} else if type == "regular" then {
386387
# ignore non-nix files
387388
} else throw ''

0 commit comments

Comments
 (0)