-
Notifications
You must be signed in to change notification settings - Fork 20
/
default.nix
41 lines (36 loc) · 1.12 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{ lib ? import <nixpkgs/lib> }:
let
find-files = import ./find-files.nix { inherit lib; };
newCleanSourceWith =
let newSrc = lib.cleanSourceWith { filter = f: t: true; src = ./.; };
in (builtins.functionArgs lib.cleanSourceWith) ? name || newSrc ? name;
gitignoreSource =
if newCleanSourceWith
then
path: gitignoreSourceWith { inherit path; }
else
path:
if path ? _isLibCleanSourceWith
then builtins.abort "Sorry, please update your Nixpkgs to 19.09 or master if you want to use gitignoreSource on cleanSourceWith"
else lib.warn "You are using gitignore.nix with an old version of Nixpkgs that is not supported." (builtins.path {
name = "source";
filter = find-files.gitignoreFilter path;
inherit path;
});
gitignoreSourceWith = { path }:
lib.cleanSourceWith {
name = "source";
filter = find-files.gitignoreFilterWith { basePath = path.origSrc or path; };
src = path;
};
in
{
inherit (find-files)
gitignoreFilter
gitignoreFilterWith
;
inherit
gitignoreSource
gitignoreSourceWith
;
}