mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
vanadium: source each environment when needed individually
This commit is contained in:
parent
0342f5e87c
commit
e7afade200
3 changed files with 24 additions and 15 deletions
|
|
@ -42,21 +42,8 @@ in {
|
||||||
programs = {
|
programs = {
|
||||||
neovim.enable = true;
|
neovim.enable = true;
|
||||||
neovim.defaultEditor = true;
|
neovim.defaultEditor = true;
|
||||||
fish = {
|
|
||||||
enable = true;
|
fish.enable = true;
|
||||||
shellInitLast = ''
|
|
||||||
if test -d ~/.environments
|
|
||||||
for file in ~/.environments/*
|
|
||||||
if not string match -q --regex -- '-link$' $file
|
|
||||||
# - global: make sure the path added is scoped to the instance of the shell
|
|
||||||
# https://github.com/fish-shell/fish-shell/issues/8604#issuecomment-2854550904
|
|
||||||
# - append: make my own environment come after a nix shell even if invoked by one
|
|
||||||
fish_add_path --global --append --move $file/bin
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
starship.enable = true;
|
starship.enable = true;
|
||||||
tmux.enable = true;
|
tmux.enable = true;
|
||||||
direnv.enable = true;
|
direnv.enable = true;
|
||||||
|
|
|
||||||
11
nix/homeModules/common/fish/functions/activate-nix-env.fish
Normal file
11
nix/homeModules/common/fish/functions/activate-nix-env.fish
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
function activate-nix-env \
|
||||||
|
--description "Add a nix environment into path"
|
||||||
|
### Arguments:
|
||||||
|
if [ (count $argv) -ne 1 ]
|
||||||
|
echo "Must provide exactly one argument, the path to be added"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
set env_name $argv[1]
|
||||||
|
|
||||||
|
fish_add_path --global "$HOME/.environments/$argv[1]/bin"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
function deactivate-nix-env \
|
||||||
|
--description "Remove a nix environment from path"
|
||||||
|
### Arguments:
|
||||||
|
if [ (count $argv) -ne 1 ]
|
||||||
|
echo "Must provide exactly one argument, the path to be removed"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
set env_name $argv[1]
|
||||||
|
|
||||||
|
fish_remove_path "$HOME/.environments/$argv[1]/bin"
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue