{ pkgs, config, inputs, ... }: { programs.zsh = { enable = true; autocd = true; autosuggestion.enable = true; enableCompletion = true; shellAliases = { ls = "${pkgs.eza}/bin/eza"; l = "${pkgs.eza}/bin/eza -l"; la = "${pkgs.eza}/bin/eza -la"; tree = "${pkgs.tre-command}/bin/tre"; cat = "${pkgs.bat}/bin/bat"; amend = "git commit --amend --no-edit"; fd = "${pkgs.fd}/bin/fd"; nix = "noglob nix"; # prevent '#' expansion }; initContent = '' eval "$(${pkgs.mcfly}/bin/mcfly init zsh)" ''; plugins = with pkgs; [ { name = "formarks"; src = fetchFromGitHub { owner = "wfxr"; repo = "formarks"; rev = "8abce138218a8e6acd3c8ad2dd52550198625944"; sha256 = "1wr4ypv2b6a2w9qsia29mb36xf98zjzhp3bq4ix6r3cmra3xij90"; }; file = "formarks.plugin.zsh"; # depends on fzf } { name = zsh-syntax-highlighting.pname; src = zsh-syntax-highlighting.src; } { name = "zsh-abbrev-alias"; src = fetchFromGitHub { owner = "momo-lab"; repo = "zsh-abbrev-alias"; rev = "637f0b2dda6d392bf710190ee472a48a20766c07"; sha256 = "16saanmwpp634yc8jfdxig0ivm1gvcgpif937gbdxf0csc6vh47k"; }; file = "abbrev-alias.plugin.zsh"; } { name = zsh-autopair.pname; src = zsh-autopair.src; } { name = zsh-z.pname; src = zsh-z.src; } ]; }; programs.starship = { enable = true; settings = { format = builtins.concatStringsSep "" [ "$hostname" "$character" ]; right_format = builtins.concatStringsSep "" [ "$cmd_duration" "$jobs" "\${custom.jj}" "$directory" "\${custom.jj_branch}" ]; add_newline = false; character = { success_symbol = "[\\$](bright-black)"; error_symbol = "[\\$](red)"; }; directory = { truncation_length = 3; format = " [$path]($style)[$read_only]($read_only_style)"; }; custom.jj = { command = "prompt"; format = "$output"; ignore_timeout = true; shell = ["${inputs.starship-jj.packages.${pkgs.system}.default}/bin/starship-jj" "--ignore-working-copy" "starship"]; use_stdin = false; when = true; }; custom.jj_branch = { command = ''jj log --no-graph -r 'latest(::@ & (bookmarks() | remote_bookmarks()))' -T 'coalesce(bookmarks.join(", "), remote_bookmarks.join(", "))' 2>/dev/null''; when = "jj root 2>/dev/null"; format = " [$output]($style)"; style = "bold yellow"; }; git_branch.disabled = true; git_status.disabled = true; command_timeout = 1000; hostname = { ssh_only = true; format = "[$hostname]($style) "; }; cmd_duration.min_time = 2000; }; }; xdg.configFile."starship-jj/starship-jj.toml".text = '' module_separator = " " reset_color = false [[module]] type = "Bookmarks" separator = " " color = "Magenta" behind_symbol = "⇡" surround_with_quotes = false [[module]] type = "Commit" previous_message_symbol = "⇣" max_length = 24 show_previous_if_empty = false empty_text = "" surround_with_quotes = false color = "Cyan" [module.non_unique] color = "Black" [[module]] type = "State" separator = " " [module.conflict] disabled = false text = "󰀨" color = "Red" [module.divergent] disabled = false text = "󰃻" color = "Cyan" [module.empty] disabled = true text = "󰟢" color = "Yellow" [module.immutable] disabled = false text = "󰌾" color = "Yellow" [module.hidden] disabled = false text = "󰈈" color = "Yellow" [[module]] type = "Metrics" template = "[{changed} {added}{removed}]" hide_if_empty = true color = "Magenta" [module.changed_files] prefix = "" suffix = "" color = "Cyan" [module.added_lines] prefix = "+" suffix = "" color = "Green" [module.removed_lines] prefix = "-" suffix = "" color = "Red" ''; programs.fzf = { enable = true; enableZshIntegration = true; }; programs.zoxide.enable = true; # lorri > nix-direnv, but lorri is not available on macOS programs.direnv = { enable = true; nix-direnv.enable = config.isMacOS; }; services.lorri.enable = !config.isMacOS; home.packages = with pkgs; [ mosh nixd ]; }