Skip to content

Commit 15a87ce

Browse files
authored
Merge pull request #551 from cachix/fix-src-pollution
2 parents 4c09990 + b24ef71 commit 15a87ce

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/pre-commit.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ let
8686
run =
8787
mkDerivation {
8888
name = "pre-commit-run";
89-
9089
src = cfg.rootSrc;
9190
buildInputs = [ cfg.gitPackage ];
9291
nativeBuildInputs = enabledExtraPackages
9392
++ lib.optional (config.settings.rust.check.cargoDeps != null) cargoSetupHook;
9493
cargoDeps = config.settings.rust.check.cargoDeps;
9594
buildPhase = ''
9695
set +e
97-
HOME=$PWD
96+
# Set HOME to a temporary directory for pre-commit to create its cache files in.
97+
HOME=$(mktemp -d)
9898
ln -fs ${configFile} .pre-commit-config.yaml
9999
git init -q
100100
git add .
@@ -111,6 +111,7 @@ let
111111
fi
112112
exitcode=$?
113113
git --no-pager diff --color
114+
# Derivations must produce an output
114115
mkdir $out
115116
[ $? -eq 0 ] && exit $exitcode
116117
'';

0 commit comments

Comments
 (0)