bashrc.nix 899 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. { pkgs, lib, ... }:
  2. {
  3. home = {
  4. file = {
  5. bashrc = {
  6. target = ".bashrc";
  7. text = ''
  8. eval "$(direnv hook bash)"
  9. current_git_branch() {
  10. git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
  11. }
  12. shlvl_prompt() {
  13. (( SHLVL > 1 )) && printf '(%d)' "$SHLVL"
  14. }
  15. PS1='$(shlvl_prompt)(\[\033[01;94m\]\u\[\033[00;00m\]@\[\033[01;94m\]\h\[\033[00;00m\]:\[\033[01;34m\]\w\[\033[00m\])\[\033[01;32m\]$(current_git_branch)\[\033[00m\]$ '
  16. nix-update() {
  17. set -e
  18. ORIG_CWD="$(pwd)"
  19. trap 'cd "$ORIG_CWD"' EXIT
  20. cd "$HOME/nix-dots"
  21. nix flake update
  22. nh os switch
  23. flatpak update -y
  24. }
  25. jc() {
  26. git clone https://github.com/johron/$1
  27. }
  28. '';
  29. };
  30. };
  31. };
  32. }