Merge pull request #21 from hercules-ci/recover-composition
Recover composition
This commit is contained in:
commit
ec4a003915
2 changed files with 29 additions and 6 deletions
|
|
@ -46,9 +46,11 @@ mkDerivation {
|
|||
- Reads parent gitignores even if only pointed at a subdirectory
|
||||
- Source hashes only change when output changes
|
||||
- Not impacted by large or inaccessible ignored directories
|
||||
- Composes with `cleanSourceWith`
|
||||
- Reads user git configuration; no need to bother your team with your tool config.
|
||||
- Also works with restrict-eval enabled (if avoiding `fetchFromGitHub`)
|
||||
- No import from derivation ("IFD")
|
||||
- Name and hash are not sensitive to checkout location
|
||||
|
||||
## Comparison
|
||||
|
||||
|
|
|
|||
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: builtins.path {
|
||||
name = "source";
|
||||
filter = find-files.gitignoreFilter path;
|
||||
inherit 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 to 19.09 or master 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