home-manager: start managing direnv

This commit is contained in:
surtur 2022-09-10 23:44:31 +02:00
parent b0a84f4cca
commit e1d79a8b6b
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
4 changed files with 35 additions and 8 deletions

@ -1,8 +0,0 @@
# as per https://github.com/direnv/direnv/wiki/Vim
add_extra_vimrc() {
local extravim="$(find_up .vimrc)"
if [ -n "$extravim" ]; then
echo "Adding extra .vimrc: ${extravim}"
path_add EXTRA_VIM $extravim
fi
}

9
nix/cli.nix Normal file

@ -0,0 +1,9 @@
{
config,
pkgs,
...
}: {
imports = [
./cli/direnv.nix
];
}

24
nix/cli/direnv.nix Normal file

@ -0,0 +1,24 @@
{
config,
pkgs,
...
}: {
programs.direnv = {
enable = true;
nix-direnv.enable = false;
stdlib = ''
if [ -f ''$HOME/.nix-profile/share/nix-direnv/direnvrc ]; then
source ''$HOME/.nix-profile/share/nix-direnv/direnvrc
fi
# as per https://github.com/direnv/direnv/wiki/Vim
add_extra_vimrc() {
local extravim="''$(find_up .vimrc)"
if [ -n "''$extravim" ]; then
echo "Adding extra .vimrc: ''${extravim}"
path_add EXTRA_VIM ''$extravim
fi
}
'';
};
}

@ -6,5 +6,7 @@
imports = [ imports = [
./programs/helix.nix ./programs/helix.nix
./programs/newsboat.nix ./programs/newsboat.nix
./cli.nix
]; ];
} }