flake/nixos/zsh.nix

110 lines
3.3 KiB
Nix
Executable file

{ pkgs, ... }: {
# starship - a customizable prompt for any shell
programs.starship = {
enable = true;
# custom settings
settings = {
format =
"[](bg:#1e1e2e fg:#a6e3a1)$username$hostname[](fg:#a6e3a1 bg:#89b4fa)$directory[](fg:#89b4fa bg:#cba6f7)$direnv[](fg:#cba6f7 bg:#f9e2af)$git_branch$git_status[](fg:#f9e2af bg:#1e1e2e)$character";
username = {
show_always = true;
format = "[ $user@]($style)";
style_user = "fg:#313244 bg:#a6e3a1";
style_root = "fg:#313244 bg:#a6e3a1";
};
hostname = {
ssh_only = false;
format = "[$hostname $ssh_symbol]($style)";
style = "fg:#313244 bg:#a6e3a1";
};
directory = {
format = "[ $path ]($style)";
style = "fg:#313244 bg:#89b4fa";
};
git_branch = {
format = "[ $symbol$branch(:$remote_branch) ]($style)";
symbol = " ";
style = "fg:#313244 bg:#f9e2af";
};
direnv = {
symbol = "󱄅 ";
format = "[ $symbol$loaded/$allowed ]($style)";
disabled = false;
style = "fg:#313244 bg:#cba6f7";
};
git_status = {
format = "[$all_status]($style)";
style = "fg:#313244 bg:#f9e2af";
};
git_metrics = {
format = "([+$added]($added_style))[]($added_style)";
added_style = "fg:#313244 bg:#f9e2af";
deleted_style = "fg:bright-red bg:235";
disabled = false;
};
hg_branch = {
format = "[ $symbol$branch ]($style)";
symbol = " ";
};
cmd_duration = {
format = "[ $duration ]($style)";
style = "fg:bright-white bg:18";
};
character = {
success_symbol = "[ ](#a6e3a1) ";
error_symbol = "[ ](#f38ba8) ";
};
};
};
users.defaultUserShell = pkgs.zsh;
programs.zsh = {
enable = true;
enableCompletion = true;
enableBashCompletion = true;
autosuggestions.enable = true;
syntaxHighlighting.enable = true;
shellInit = ''
export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
'';
histSize = 10000;
histFile = "$HOME/.zsh_history";
shellAliases = let ezaArgs = "--time-style='+%Y-%m-%d %H:%M' --icons";
in {
ff = "fastfetch";
neofetch = "fastfetch";
nf = "fastfetch";
lg = "lazygit";
lad = "lazydocker";
clip = "wl-copy";
paste = "wl-paste";
cat = "bat";
l = "eza -lhg ${ezaArgs}";
la = "eza -lAh ${ezaArgs}";
ll = "eza -lhg ${ezaArgs}";
ls = "eza ${ezaArgs}";
lsa = "eza -lah ${ezaArgs}";
tree = "eza --tree --git-ignore ${ezaArgs}";
nixrc = "$EDITOR /etc/nixos";
upd =
"sudo nixos-generate-config --dir /etc/nixos/hosts && sudo rm /etc/nixos/hosts/configuration.nix && sudo mv /etc/nixos/hosts/hardware-configuration.nix /etc/nixos/hosts/$(hostname).nix && git -C /etc/nixos --git-dir=/etc/nixos/.git add /etc/nixos/hosts/$(hostname).nix && sudo nixos-rebuild switch";
taildrop = "tailscale file";
forgejo-runner = "act_runner";
runactions =
"act_runner exec --default-actions-url=https://www.coastalcommits.com --gitea-instance=https://www.coastalcommits.com";
c = "clear";
# alias sudo to itself so user aliases can be sudoed
sudo = "sudo ";
s = "sudo ";
};
};
}