Skip to content

Commit ed8a7ec

Browse files
committed
readme
1 parent 27ad2a0 commit ed8a7ec

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

README.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ Import all nix files inside `./modules` in your flake:
2222

2323
🌳 Works with NixOS, nix-darwin, home-manager, flake-parts, NixVim, etc.\
2424
🌲 Callable as a deps-free Flake or nix lib.\
25-
🌴 API for listing custom file types with filters and transformations.\
26-
🌵 Extensible: add your own API methods to tailor import-tree objects.\
27-
🎄 No dependencies outside flakes: just `import ./default.nix`.\
25+
🌴 Sensible defaults and configurable behaviour.\
26+
🌵 API for listing custom file types with filters and transformations.\
27+
🎄 Extensible: add your own API methods to tailor import-tree objects.\
2828
🌿 Useful on [Dendritic Pattern](https://github.com/mightyiam/dendritic) setups.\
2929
🌱 [Growing](https://github.com/search?q=language%3ANix+import-tree&type=code) [community](https://vic.github.io/dendrix/Dendrix-Trees.html) [adoption](https://github.com/vic/flake-file)
3030

@@ -126,7 +126,7 @@ Or, in a simpler but less readable way:
126126
((import-tree.map lib.traceVal).filter (lib.hasInfix ".mod.")) ./modules
127127
```
128128

129-
##### `import-tree.filter` and `import-tree.filterNot`
129+
##### 🌲 `import-tree.filter` and `import-tree.filterNot`
130130

131131
`filter` takes a predicate function `path -> bool`. Only files with suffix `.nix` are candidates.
132132

@@ -136,7 +136,7 @@ import-tree.filter (lib.hasInfix ".mod.") ./some-dir
136136

137137
Multiple filters can be combined, results must match all of them.
138138

139-
##### `import-tree.match` and `import-tree.matchNot`
139+
##### 🌳 `import-tree.match` and `import-tree.matchNot`
140140

141141
`match` takes a regular expression. The regex should match the full path for the path to be selected. Matching is done with `builtins.match`.
142142

@@ -146,7 +146,7 @@ import-tree.match ".*/[a-z]+@(foo|bar)\.nix" ./some-dir
146146

147147
Multiple match filters can be added, results must match all of them.
148148

149-
##### `import-tree.map`
149+
##### 🌴 `import-tree.map`
150150

151151
`map` can be used to transform each path by providing a function.
152152

@@ -166,7 +166,7 @@ lib.pipe import-tree [
166166
# => list of contents of all files.
167167
```
168168

169-
##### `import-tree.addPath`
169+
##### 🌵 `import-tree.addPath`
170170

171171
`addPath` can be used to prepend paths to be filtered as a setup for import-tree.
172172

@@ -175,7 +175,7 @@ lib.pipe import-tree [
175175
import-tree [./vendor ./modules]
176176
```
177177

178-
##### `import-tree.addAPI`
178+
##### 🎄 `import-tree.addAPI`
179179

180180
`addAPI` extends the current import-tree object with new methods.
181181

@@ -187,35 +187,35 @@ import-tree.addAPI {
187187
}
188188
```
189189

190-
##### `import-tree.withLib`
190+
##### 🌿 `import-tree.withLib`
191191

192192
`withLib` is required prior to invocation of any of `.leafs` or `.pipeTo` when not used as part of a nix modules evaluation.
193193

194194
```nix
195195
import-tree.withLib pkgs.lib
196196
```
197197

198-
##### `import-tree.pipeTo`
198+
##### 🌱 `import-tree.pipeTo`
199199

200200
`pipeTo` takes a function that will receive the list of paths.
201201

202202
```nix
203203
import-tree.pipeTo lib.id # equivalent to `.leafs`
204204
```
205205

206-
##### `import-tree.leafs`
206+
##### 🍃 `import-tree.leafs`
207207

208208
`leafs` takes no arguments, it is equivalent to calling `import-tree.pipeTo lib.id`.
209209

210210
```nix
211211
import-tree.leafs
212212
```
213213

214-
##### `import-tree.new`
214+
##### 🌲 `import-tree.new`
215215

216216
Returns a fresh import-tree with empty state.
217217

218-
##### `import-tree.initFilter`
218+
##### 🌳 `import-tree.initFilter`
219219

220220
*Replaces* the initial filter which defaults to: Include files with `.nix` suffix and not having `/_` infix.
221221

@@ -224,7 +224,7 @@ import-tree.initFilter (p: lib.hasSuffix ".nix" p && !lib.hasInfix "/ignored/" p
224224
import-tree.initFilter (lib.hasSuffix ".md")
225225
```
226226

227-
##### `import-tree.files`
227+
##### 🌴 `import-tree.files`
228228

229229
A shorthand for `import-tree.leafs.result`. Returns a list of matching files.
230230

@@ -237,7 +237,7 @@ lib.pipe import-tree [
237237
]
238238
```
239239

240-
##### `import-tree.result`
240+
##### 🌵 `import-tree.result`
241241

242242
Exactly the same as calling the import-tree object with an empty list `[ ]`.
243243

@@ -262,18 +262,13 @@ to learn about the Dendritic pattern advantages.
262262

263263
### Sharing pre-configured subtrees of modules
264264

265-
<details>
266-
<summary>
267-
268265
Since the import-tree API is _extensible_ and lets you add paths or
269266
filters at configuration time, configuration-library authors can
270267
provide custom import-tree instances with an API suited for their
271268
particular idioms.
272269

273270
@vic is using this on [Dendrix](https://github.com/vic/dendrix) for [community conventions](https://github.com/vic/dendrix/blob/main/dev/modules/community/_pipeline.nix) on tagging files.
274271

275-
</summary>
276-
277272
This would allow us to have community-driven *sets* of configurations,
278273
much like those popular for editors: spacemacs/lazy-vim distributions.
279274

0 commit comments

Comments
 (0)