Provide an alias for `or`
utdemir opened this issue · comments
or
, when used alone, seems to be a keyword. So, it's not possible to use the builtin or
matcher inside a with statement:
src = nix-filter {
root = ./.;
include = with nix-filter; [
(and
(or (inDirectory "src") (inDirectory "test"))
(matchExt "hs"))
];
};
fails with:
error: syntax error, unexpected OR_KW
Although there is a workaround of using nix-filter.or
, it would be nice to provide an alias, so something like above is possible. The first name I'd reach in this case would probably be or_
.
I do not know why this isn't the case with and
.
Good call, thanks for trying this out!
All the directories have to explicitly be added, by the way, otherwise builtins.path
won't recurse into them.
nix-filter {
root = ./.;
include = with nix-filter; [
(and
(or_ (inDirectory "src") (inDirectory "test"))
(or_ isDirectory (matchExt "hs")))
];
}
Thanks, I haven't thought of that! I'm looking forward to the issue you linked to have it more convenient.