From ec7e554ce90e735c0cb6ff265e332ad3a977f915 Mon Sep 17 00:00:00 2001 From: Victor Borja Date: Tue, 1 Jul 2025 10:18:39 -0600 Subject: [PATCH] Use toString on attrs having outPath --- checkmate.nix | 9 +++++++++ default.nix | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/checkmate.nix b/checkmate.nix index 7c9362b..a0bff8d 100644 --- a/checkmate.nix +++ b/checkmate.nix @@ -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) diff --git a/default.nix b/default.nix index 5f5ec0e..9ee0c97 100644 --- a/default.nix +++ b/default.nix @@ -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 @@ -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;