Compare commits
2 Commits
master
...
20b2dfac7c
| Author | SHA1 | Date | |
|---|---|---|---|
| 20b2dfac7c | |||
|
|
da4b0586e5 |
10
default.nix
10
default.nix
@@ -1,9 +1,4 @@
|
|||||||
{ stdenv
|
{ stdenv, direnv, term-test }:
|
||||||
, direnv
|
|
||||||
, term-test ? null
|
|
||||||
, doCheck ? true
|
|
||||||
}:
|
|
||||||
assert doCheck -> term-test != null;
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "direnv-cache";
|
name = "direnv-cache";
|
||||||
@@ -13,7 +8,6 @@ stdenv.mkDerivation {
|
|||||||
make install PREFIX=$out
|
make install PREFIX=$out
|
||||||
'';
|
'';
|
||||||
checkInputs = [ term-test ];
|
checkInputs = [ term-test ];
|
||||||
inherit doCheck;
|
doCheck = true;
|
||||||
passthru = { direnvrc = ./direnvrc; };
|
passthru = { direnvrc = ./direnvrc; };
|
||||||
preferLocalBuild = true;
|
|
||||||
}
|
}
|
||||||
|
|||||||
16
direnv-cache
16
direnv-cache
@@ -70,23 +70,9 @@ getCacheFilePath() {
|
|||||||
echo "${cacheDir}/$(pwd | sha1sum | tr -d ' -')"
|
echo "${cacheDir}/$(pwd | sha1sum | tr -d ' -')"
|
||||||
}
|
}
|
||||||
|
|
||||||
switchToDirenvDir() {
|
|
||||||
# Find directory that contains the current .envrc. Allows direnv-cache to
|
|
||||||
# be called from subdirectories.
|
|
||||||
wd="$(pwd)"
|
|
||||||
|
|
||||||
if [[ -n $DIRENV_DIR ]]; then
|
|
||||||
wd="${DIRENV_DIR#-}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd "$wd"
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd="$1"
|
cmd="$1"
|
||||||
|
|
||||||
switchToDirenvDir
|
if ! [[ -e .envrc ]]; then
|
||||||
|
|
||||||
if ! [[ -e ".envrc" ]]; then
|
|
||||||
echo "Error, no .envrc found in current directory"
|
echo "Error, no .envrc found in current directory"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user