on iko/ghcjs-patch-master help sign in
Discuss custom source filters in user guide (#418)
commitd17a3c6e1818e0035cb9778973063165a6373d12 authorEdward Amsden <edward@blackriversoft.com> dateMon 27 Jan 2020, 18:22 (7 years ago) parentecff684
1 file changed+10
docs/user-guide.md+10
docs/user-guide.md+10
@@ -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
131141You can build a component from your project with `nix-build` (in this
132142case the `hello` executable in a `helloworld` package):