nixos-config/users/simon/modules/zsh.nix

89 lines
2.4 KiB
Nix

{ lib, pkgs, ... }:
let
dircolors-solarized = pkgs.fetchFromGitHub {
owner = "seebi";
repo = "dircolors-solarized";
rev = "65d4d595ceca96166139862131a006fa3079e00a";
sha256 = "1nl5rs24gi7zqg7nqsbf9fa94yggwzqf3n3imxgfywl8jny3cj1q";
meta.license = lib.licenses.mit;
};
in
{
programs = {
fzf = {
enable = true;
changeDirWidgetCommand = "fd --color always --type d";
changeDirWidgetOptions = [ "--preview 'exa --tree --color=always -L 4 {}'" ];
defaultCommand = "fd --color always";
defaultOptions = [
"--ansi"
"--color=bg+:#073642,bg:#002b36,spinner:#2aa198,hl:#268bd2"
"--color=fg:#839496,header:#268bd2,info:#b58900,pointer:#2aa198"
"--color=marker:#2aa198,fg+:#eee8d5,prompt:#b58900,hl+:#268bd2"
];
fileWidgetCommand = "fd --color always --type f";
fileWidgetOptions = [ "--preview 'head -n 100 {}'" ];
};
direnv = {
enable = true;
nix-direnv = {
enable = true;
enableFlakes = true;
};
};
starship = {
enable = true;
settings = {
add_newline = false;
};
};
zsh = {
enable = true;
history = {
save = 100000;
size = 100000;
};
plugins = [
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = "${pkgs.zsh-nix-shell}/share/zsh-nix-shell";
}
];
shellAliases = {
cp = "cp --reflink=auto"; # TODO: remove with coreutils > 8.32
exa = "exa --git --binary";
ipy = "ipython3";
l = "exa -l";
la = "exa -la";
ll = "exa -l";
ls = "exa";
userctl = "systemctl --user";
vim = "nvim";
vimdiff = "nvim -d";
ip = "ip --color=auto";
};
envExtra = ''
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on"
'';
initExtra = lib.mkMerge [
(lib.mkBefore ''
prompt off # collides with starship
'')
(lib.mkAfter ''
eval $(${pkgs.coreutils}/bin/dircolors -b ${dircolors-solarized}/dircolors.ansi-universal)
# no sad smiley (starship shows exit status)
zstyle ':prompt:grml:right:setup' items
# do not glob # (conflicts with nix flakes)
disable -p '#'
source ${../files/zsh/pass-wrappers.zsh}
'')
];
};
};
}