Add extraRules to gitignoreFilterWith

This commit is contained in:
Robert Hensing 2022-07-21 13:24:03 +02:00
parent f2ea0f8ff1
commit fad6033fca
3 changed files with 31 additions and 10 deletions

View file

@ -14,16 +14,18 @@ for paths at or below this root path.
```nix
let
gitignore = (import (import ./nix/sources.nix)."gitignore.nix" { inherit lib; });
inherit (gitignore) gitignoreFilter;
inherit (gitignore) gitignoreFilterWith;
customerFilter = src:
let
# IMPORTANT: use a let binding like this to memoize info about the git directories.
srcIgnored = gitignoreFilter src;
srcIgnored = gitignoreFilterWith { basePath = src; extraRules = ''
*.xml
!i-need-this.xml
''; };
in
path: type:
srcIgnored path type
|| builtins.baseNameOf path == "i-need-this.xml";
srcIgnored path type && baseNameOf path != "just-an-example-of-custom-filter-code.out";
name = "example";
exampleSrc = ./.;