Skip to content

Commit d17a3c6

Browse files
eamsdenhamishmack
authored andcommitted
Discuss custom source filters in user guide (#418)
1 parent ecff684 commit d17a3c6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/user-guide.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,16 @@ on using cleanGit](clean-git.md)). For example:
127127
{ src = ./.; subDir = "subdir/another-subdir"; };
128128
```
129129

130+
If you want to use a custom filtering function, don't use the built-in nix `filterSource` function.
131+
Due to some technicalities about how filtering and the nix store work, it will cause all components in
132+
your project to be rebuilt any time any part of the project source changes. Use `cleanSourceWith` instead:
133+
134+
```
135+
src = pkgs.haskell-nix.haskellLib.cleanSourceWith
136+
{ src = ./.; filter = myFilterFunction; };
137+
```
138+
139+
Note that `cleanSourceWith` will also take the `subDir` argument.
130140

131141
You can build a component from your project with `nix-build` (in this
132142
case the `hello` executable in a `helloworld` package):

0 commit comments

Comments
 (0)