bashrc.nix 924 B

123456789101112131415161718192021222324252627282930313233343536
  1. { pkgs, lib, ... }:
  2. {
  3. home = {
  4. file = {
  5. bashrc = {
  6. target = ".bashrc";
  7. text = ''
  8. current_git_branch() {
  9. git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
  10. }
  11. shlvl_prompt() {
  12. (( SHLVL > 1 )) && printf '(%d)' "$SHLVL"
  13. }
  14. 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\]$ '
  15. nix-update() {
  16. set -e
  17. ORIG_CWD="$(pwd)"
  18. sudo nix-channel --update
  19. cd "$HOME/nix-dots"
  20. nix flake update
  21. nh os switch
  22. flatpak update -y
  23. sudo flatpak update -y
  24. cd "$ORIG_CWD"
  25. }
  26. jclone() {
  27. git clone https://github.com/johron/$1
  28. }
  29. '';
  30. };
  31. };
  32. };
  33. }