Skip to content

Commit

Permalink
feat: add support for Nix build environment
Browse files Browse the repository at this point in the history
  • Loading branch information
m15a authored and edouard-lopez committed Jan 25, 2024
1 parent daeb7ed commit 6dd1adc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions conf.d/pure.fish
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 48,11 @@ _pure_set_default pure_color_jobs pure_color_normal
_pure_set_default pure_show_system_time false
_pure_set_default pure_color_system_time pure_color_mute

# Nix build environment
_pure_set_default pure_enable_nixdevshell true
_pure_set_default pure_symbol_nixdevshell_prefix ""
_pure_set_default pure_color_nixdevshell pure_color_mute

# env for Python
_pure_set_default pure_enable_virtualenv true
_pure_set_default pure_symbol_virtualenv_prefix "" # 🐍
Expand Down
2 changes: 2 additions & 0 deletions functions/_pure_prompt.fish
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 3,7 @@ function _pure_prompt \
--argument-names exit_code

set --local jobs (_pure_prompt_jobs)
set --local nixdevshell (_pure_prompt_nixdevshell) # Nix build environment indicator
set --local virtualenv (_pure_prompt_virtualenv) # Python virtualenv name
set --local vimode_indicator (_pure_prompt_vimode) # vi-mode indicator
set --local pure_symbol (_pure_prompt_symbol $exit_code)
Expand All @@ -20,6 21,7 @@ function _pure_prompt \
$system_time \
$root_prefix \
$jobs \
$nixdevshell \
$virtualenv \
$vimode_indicator \
$pure_symbol \
Expand Down
17 changes: 17 additions & 0 deletions functions/_pure_prompt_nixdevshell.fish
Original file line number Diff line number Diff line change
@@ -0,0 1,17 @@
function _pure_prompt_nixdevshell \
--description "Indicate if nix develop shell is activated"

if set --query pure_enable_nixdevshell;
and test "$pure_enable_nixdevshell" = true

set --local nixdevshell ''
set --local nixdevshell_color (_pure_set_color $pure_color_nixdevshell)
if test -n "$IN_NIX_SHELL"
set nixdevshell $IN_NIX_SHELL
end

if test -n $nixdevshell
echo "$pure_symbol_nixdevshell_prefix$nixdevshell_color$nixdevshell"
end
end
end

0 comments on commit 6dd1adc

Please sign in to comment.