From 0f1a8d59d56ae1a419f692cb67b71c6d642ff615 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 6 Sep 2019 21:44:27 +0200 Subject: [PATCH 1/5] Use cleanSourceWith again --- default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index f52045d..888bab0 100644 --- a/default.nix +++ b/default.nix @@ -5,9 +5,9 @@ in { inherit (find-files) gitignoreFilter; - gitignoreSource = path: builtins.path { + gitignoreSource = path: lib.cleanSourceWith { name = "source"; filter = find-files.gitignoreFilter path; - inherit path; + src = path; }; } From 264206c662c01d83812d85f4c661c3d299140266 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 6 Sep 2019 21:44:50 +0200 Subject: [PATCH 2/5] Revert "Remove cleanSourceWith from features list (see #11)" This reverts commit 26137f3c2e33896fb0ea6414099a6f26f4720fa7. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5ccda96..1a1adcb 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ 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") From 0935208a30e55578620ba92c3a0447369d2c32c9 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 6 Sep 2019 21:46:57 +0200 Subject: [PATCH 3/5] Add name insensitivity to features --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1a1adcb..30323bf 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ mkDerivation { - 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 From 23d2f2b0fdf31e86e99b0b2bd5222e7212911a84 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Wed, 11 Sep 2019 16:53:36 +0200 Subject: [PATCH 4/5] Always deterministic, composable on newer Nixpkgs --- default.nix | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/default.nix b/default.nix index 888bab0..0f381ac 100644 --- a/default.nix +++ b/default.nix @@ -1,13 +1,34 @@ { lib ? import }: 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; + }; } From 1679da2db25056d49c0fa2c5d5827c71b7620aaa Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Thu, 12 Sep 2019 11:09:23 +0200 Subject: [PATCH 5/5] Update default.nix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Domen Kožar --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 0f381ac..68fc3b2 100644 --- a/default.nix +++ b/default.nix @@ -25,7 +25,7 @@ in else path: if path ? _isLibCleanSourceWith - then builtins.abort "Sorry, please update your Nixpkgs if you want to use gitignoreSource on cleanSourceWith" + 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;