diff --git a/dotfiles/bash_prompt b/dotfiles/bash_prompt new file mode 100644 index 0000000..abb5975 --- /dev/null +++ b/dotfiles/bash_prompt @@ -0,0 +1,34 @@ +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color|*-256color) color_prompt=yes;; +esac + +function __set_prompt() { + local branch + branch=$(git branch --show-current 2>/dev/null) + + # Colors (wrapped in \[ \] for proper length calculation) + local yellow_bg='\[\033[43;30m\]' + local blue_bg='\[\033[44;30m\]' + local yellow_on_blue='\[\033[44;33m\]' + local blue='\[\033[0;34m\]' + local yellow='\[\033[0;33m\]' + local reset='\[\033[0m\]' + local arrow=$'' + + if [[ -n "$branch" ]]; then + PS1="${yellow_bg} \w ${yellow_on_blue}${arrow}${blue_bg} ${branch} ${blue}${arrow}${reset} " + else + PS1="${yellow_bg} \w ${yellow}${arrow}${reset} " + fi +} + +if [ "$color_prompt" = yes ]; then + PROMPT_COMMAND=__set_prompt +else + PS1='\w\$ ' +fi + +unset color_prompt + +printf '\033[3 q' diff --git a/home.nix b/home.nix index e2d5b4c..8c2b278 100644 --- a/home.nix +++ b/home.nix @@ -17,9 +17,12 @@ # Programs configured via `programs..enable` below are installed # automatically, so they do not belong here. home.packages = [ - pkgs.gh - pkgs.pi-coding-agent + pkgs.bubblewrap pkgs.claude-code + pkgs.gh + pkgs.jq + pkgs.nodejs_26 + pkgs.pi-coding-agent pkgs.proton-vpn pkgs.vscodium ]; @@ -32,11 +35,15 @@ # This attribute set is translated into ~/.config/alacritty/alacritty.toml settings = { window = { - padding = { x = 5; y = 5; }; + padding = { x = 10; y = 10; }; decorations = "None"; }; colors.primary.background = "#000000"; font.size = 11; + terminal.shell = { + program = "/bin/bash"; + args = [ "-l" "-c" "tmux attach || tmux" ]; + }; }; }; @@ -45,13 +52,39 @@ ############################################################################# programs.tmux = { enable = true; - prefix = "C-a"; # replaces the unbind C-b / set prefix dance + prefix = "C-a"; mouse = true; extraConfig = '' - # Home Manager writes the config to ~/.config/tmux/tmux.conf - bind r source-file ~/.config/tmux/tmux.conf \; display-message "RELOADING CONFIGURATION FILE…" + bind r source-file ~/.tmux.conf \; display-message "RELOADING CONFIGURATION FILE…" set -g status-style bg=white,fg=black + set -g window-active-style bg=black + set -g window-style bg=#212121 + + set -g pane-border-style fg=gray + set -g pane-border-lines heavy + set -g pane-active-border-style fg=yellow + set -g pane-border-status bottom + set -g pane-border-format ${"''"} + + set -g window-status-current-format '[#I:#W]' + set -g window-status-format '#I:#W' + set -g window-status-current-style fg=yellow + + set -g @plugin 'tmux-plugins/tpm' + + set-option -g status-right "" + set-option -g status-left "" + set -g status-style bg=default + + bind-key H display-popup -E "htop" + bind-key N display-popup -E 'tmux new-session -A -s scratch ~/go/bin/klod \; set status off' + + bind '"' split-window -c "#{pane_current_path}" + bind % split-window -h -c "#{pane_current_path}" + bind c new-window -c "~/Documents" + + run '~/.tmux/plugins/tpm/tpm' ''; }; @@ -77,13 +110,37 @@ ############################################################################# programs.bash = { enable = true; + promptInit = builtins.readFile ./dotfiles/bash_prompt; shellAliases = { c = "clear"; - gcam = "git checkout master && git pull"; + gm = "git checkout master && git pull"; count = "ls -1 | wc -l"; }; }; + ############################################################################# + # Git + ############################################################################# + programs.git = { + enable = true; + config.user = { + name = "Leo Alho"; + email = "leoalho@proton.me"; + }; + lfs.enable = true; + settings.alias = { + co = "checkout"; + br = "branch"; + c = "commit"; + a = "add"; + p = "push"; + st = "status"; + }; + extraConfig = { + init.defaultBranch = "main"; + }; + }; + # Plain files that have no dedicated module can still be managed here, either # inline with `.text` or - preferably - from a file in dotfiles/: #