fedimint icon indicating copy to clipboard operation
fedimint copied to clipboard

Added how to double check that nix develop worked

Open matthiasdebernardini opened this issue 2 years ago • 8 comments

matthiasdebernardini avatar Aug 23 '22 22:08 matthiasdebernardini

Codecov Report

Merging #453 (6a85f50) into master (10398d5) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #453   +/-   ##
=======================================
  Coverage   74.54%   74.54%           
=======================================
  Files          83       83           
  Lines       10550    10550           
=======================================
  Hits         7865     7865           
  Misses       2685     2685           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Aug 23 '22 22:08 codecov-commenter

Nice :) Was just talking with @dpc about this. He suggested altering PS1 in bashrc (or other) like this:

  set -l nix_shell_info (
      if test -n "$IN_NIX_SHELL"
            echo -n "{NS} "
      end
    )
    echo -n -s "$nix_shell_info"

maybe this could be added to the readme

NicolaLS avatar Aug 23 '22 22:08 NicolaLS

Nice :) Was just talking with @dpc about this. He suggested altering PS1 in bashrc (or other) like this:

  set -l nix_shell_info (
      if test -n "$IN_NIX_SHELL"
            echo -n "{NS} "
      fi
    )
    echo -n -s "$nix_shell_info"

maybe this could be added to the readme

(thats his settup not a copy and paste solution (I just noticed))

NicolaLS avatar Aug 23 '22 22:08 NicolaLS

Also, gotta rebase now.

justinmoon avatar Aug 23 '22 22:08 justinmoon

@NicolaLS For bash something like:

export PS1="$(test -n "$IN_NIX_SHELL" && echo "NX") $PS1"

should do. It can be added to ~/.bashrc at the bottom.

dpc avatar Aug 23 '22 23:08 dpc

@dpc noticed this didnt really work for me I ended up doing something like:

if [[ -z $IN_NIX_SHELL ]]; then
        export PS1="nix-dev $PS1";
fi

@matthiasdebernardini maybe check if you want to change to this

NicolaLS avatar Aug 24 '22 22:08 NicolaLS

@dpc noticed this didnt really work for me I ended up doing something like:

if [[ -z $IN_NIX_SHELL ]]; then
        export PS1="nix-dev $PS1";
fi

@matthiasdebernardini maybe check if you want to change to this

Sorry just noticed this dosn't work either. Your ps1 will not revert back to normal..I'll post something else

NicolaLS avatar Aug 25 '22 14:08 NicolaLS

Ok finally:

function set_custom_prompt {
#added on Aug. 23 to know when in nix develop
	if [[ "$IN_NIX_SHELL" = "impure" ]]; then
		export PS1="nix-dev";
	else
		export PS1="λ \W "; #put your default ps1 here
	fi

}

PROMPT_COMMAND='set_custom_prompt'

This also resets the PS1. Since this his so highly custom idk if this should go in the readme but wanted to correct my previous comment which was wrong. @matthiasdebernardini

NicolaLS avatar Aug 25 '22 15:08 NicolaLS