Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions checkmate.nix
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@ in
expected = "world";
};

import-tree."test take as arg anything path convertible" = {
expr = lit.leafs [
{
outPath = ./tree/modules/hello-world;
}
];
expected = [ ./tree/modules/hello-world/mod.nix ];
};

import-tree."test can take other import-trees as if they were paths" = {
expr = (lit.filter (lib.hasInfix "mod")).leafs [
(it.addPath ./tree/modules/hello-option)
Expand Down
4 changes: 4 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ let
x:
if isImportTree x then
treeFiles x
else if hasOutPath x then
listFilesRecursive x.outPath
else if lib.pathIsDirectory x then
lib.filesystem.listFilesRecursive x
else
Expand Down Expand Up @@ -69,6 +71,8 @@ let
attrs: k: f:
attrs // { ${k} = f attrs.${k}; };

hasOutPath = and (x: x ? outPath) builtins.isAttrs;

isImportTree = and (x: x ? __config.__functor) builtins.isAttrs;

inModuleEval = and (x: x ? options) builtins.isAttrs;
Expand Down