1
0
Fork 0

Move direnv to file

This commit is contained in:
Daniel Kempkens 2022-01-08 18:03:55 +01:00
parent 9521ebc564
commit f5ba28c8cf
2 changed files with 41 additions and 5 deletions

View file

@ -4,6 +4,7 @@
imports = [
./programs/fish.nix
./programs/starship.nix
./programs/direnv.nix
./config/kitty.nix
./programs/nvim
@ -75,11 +76,6 @@
programs = {
home-manager.enable = true;
direnv = {
enable = true;
nix-direnv.enable = true;
};
zoxide.enable = true;
};
}

40
programs/direnv.nix Normal file
View file

@ -0,0 +1,40 @@
{
programs.direnv = {
enable = true;
nix-direnv.enable = true;
stdlib = ''
project() {
local cmd=$1
log_status "project $*"
shift
"project_$cmd" "$@"
}
# Languages
project_ruby() {
export GEM_HOME=$(direnv_layout_dir)/gem
export BUNDLE_USER_HOME=$(direnv_layout_dir)/bundle
PATH_add $GEM_HOME/bin
}
project_node() {
export NODE_PATH=$(direnv_layout_dir)/node
export NPM_CONFIG_PREFIX=$(direnv_layout_dir)/npm/config
export NPM_CONFIG_CACHE=$(direnv_layout_dir)/npm/cache
PATH_add $NODE_PATH/bin
PATH_add node_modules/.bin
}
# Frameworks
project_rails() {
project_ruby()
project_node()
}
'';
};
}