Clarify gitignoreFilter example
This commit is contained in:
parent
3f94c456e3
commit
eea2487dbb
1 changed files with 16 additions and 4 deletions
|
|
@ -16,12 +16,24 @@ let
|
|||
gitignore = (import (import ./nix/sources.nix)."gitignore.nix" { inherit lib; });
|
||||
inherit (gitignore) gitignoreFilter;
|
||||
|
||||
useGitFilesInSomeWay = src:
|
||||
customerFilter = src:
|
||||
let
|
||||
# IMPORTANT: use a let binding like this to memoize info about the git directories.
|
||||
f = gitignoreFilter src;
|
||||
srcIgnored = gitignoreFilter src;
|
||||
in
|
||||
somethingUseful (path: type: f path type || false);
|
||||
path: type:
|
||||
srcIgnored path type
|
||||
|| builtins.baseNameOf path == "i-need-this.xml";
|
||||
|
||||
name = "example";
|
||||
exampleSrc = ./.;
|
||||
in
|
||||
useGitFilesInSomeWay ./.
|
||||
mkDerivation {
|
||||
inherit name;
|
||||
src = cleanSourceWith {
|
||||
filter = customerFilter exampleSrc;
|
||||
src = exampleSrc;
|
||||
name = name + "-source";
|
||||
};
|
||||
};
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue