Always deterministic, composable on newer Nixpkgs
This commit is contained in:
parent
0935208a30
commit
23d2f2b0fd
1 changed files with 27 additions and 6 deletions
33
default.nix
33
default.nix
|
|
@ -1,13 +1,34 @@
|
|||
{ 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;
|
||||
|
||||
in
|
||||
{
|
||||
inherit (find-files) gitignoreFilter;
|
||||
|
||||
gitignoreSource = path: lib.cleanSourceWith {
|
||||
name = "source";
|
||||
filter = find-files.gitignoreFilter path;
|
||||
src = path;
|
||||
};
|
||||
|
||||
gitignoreSource =
|
||||
if newCleanSourceWith
|
||||
then
|
||||
path:
|
||||
let
|
||||
origPath = path.origPath or path;
|
||||
in
|
||||
lib.cleanSourceWith {
|
||||
name = "source";
|
||||
filter = find-files.gitignoreFilter origPath;
|
||||
src = path;
|
||||
}
|
||||
else
|
||||
path:
|
||||
if path ? _isLibCleanSourceWith
|
||||
then builtins.abort "Sorry, please update your Nixpkgs if you want to use gitignoreSource on cleanSourceWith"
|
||||
else builtins.path {
|
||||
name = "source";
|
||||
filter = find-files.gitignoreFilter path;
|
||||
inherit path;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue