aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/lib/filesystem.nix
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/nixpkgs/lib/filesystem.nix')
-rw-r--r--infra/libkookie/nixpkgs/lib/filesystem.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/lib/filesystem.nix b/infra/libkookie/nixpkgs/lib/filesystem.nix
index fc35a1a72c64..0a1275e547cf 100644
--- a/infra/libkookie/nixpkgs/lib/filesystem.nix
+++ b/infra/libkookie/nixpkgs/lib/filesystem.nix
@@ -42,4 +42,16 @@
type = (builtins.readDir parent).${base} or null;
in file == /. || type == "directory";
in go (if isDir then file else parent);
+
+
+ # listFilesRecursive: Path -> [ Path ]
+ #
+ # Given a directory, return a flattened list of all files within it recursively.
+ listFilesRecursive = dir: lib.flatten (lib.mapAttrsToList (name: type:
+ if type == "directory" then
+ lib.filesystem.listFilesRecursive (dir + "/${name}")
+ else
+ dir + "/${name}"
+ ) (builtins.readDir dir));
+
}