home/direnv: improve use, add unuse
This commit is contained in:
parent
7e1b33d2bc
commit
57cb03b2c7
1 changed files with 9 additions and 2 deletions
|
@ -2,9 +2,16 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
use = pkgs.writeShellScriptBin "use" ''
|
use = pkgs.writeShellScriptBin "use" ''
|
||||||
echo "use ''${@:-flake}" >> .envrc
|
echo "use ''${@:-flake}" > .envrc
|
||||||
|
if test -e .git && ! ${pkgs.gnugrep}/bin/grep -qm1 '\.envrc' .git/info/exclude; then
|
||||||
|
echo ".envrc" >> .git/info/exclude
|
||||||
|
echo ".direnv/" >> .git/info/exclude
|
||||||
|
fi
|
||||||
${pkgs.direnv}/bin/direnv allow
|
${pkgs.direnv}/bin/direnv allow
|
||||||
'';
|
'';
|
||||||
|
unuse = pkgs.writeShellScriptBin "unuse" ''
|
||||||
|
${pkgs.coreutils}/bin/rm .envrc
|
||||||
|
'';
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -18,5 +25,5 @@ in
|
||||||
|
|
||||||
home.sessionVariables.DIRENV_LOG_FORMAT = "";
|
home.sessionVariables.DIRENV_LOG_FORMAT = "";
|
||||||
|
|
||||||
home.packages = [ use ];
|
home.packages = [ use unuse ];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue