nixos-config/home-manager/shell.nix

86 lines
2.2 KiB
Nix

{ pkgs, common, ... }:
{
programs.zsh = {
enable = true;
enableCompletion = false; # manage completions ourself
dotDir = ".config/zsh";
history.share = false;
shellAliases = {
x = "startx";
rm = "rm -i";
cal = "cal -m";
ls = "ls --color";
cd = "z";
};
envExtra = ''
PROMPT=$'%B%n%b@%B%m%b: %~\nλ '
export BROWSER=firefox
export XINITRC="${common.homeDir}/bin/xinitrc"
export XAUTHORITY="${common.homeDir}/.local/share/Xauthority"
export PASH_KEYID="3E4A909C8FEF6E3783699C79DFC26EF8EDAD6D71"
export QT_AUTO_SCREEN_FACTOR=1
export PATH="${common.homeDir}/bin:$PATH"
'';
sessionVariables = {
DIRENV_LOG_FORMAT = "";
};
initExtra = ''
autoload -Uz compinit
compinit -C
(exec compinit &)
_comp_options+=(globdots)
setopt autocd
setopt noautomenu
setopt nomenucomplete
setopt TRANSIENT_RPROMPT
nix-subcommand() {
cmd="$1"
shift
pkgs=()
for pkg in "$@"; do
shift
[ "$pkg" = -- ] && break
[ "$pkg" = "''${pkg##*#}" ] && pkg="nixpkgs#$pkg"
pkgs+="$pkg"
done
export NIXPKGS_ALLOW_UNFREE=1 NIXPKGS_ALLOW_BROKEN=1
nix "$cmd" --impure "''${pkgs[@]}" -- "$@"
}
shell() { nix-subcommand "shell" "$@" }
run() { nix-subcommand "run" "$@" }
build() { nix-subcommand "build" "$@" }
KEYTIMEOUT=1
MODE_INDICATOR_VICMD='%K{10}%F{8}%B NORMAL %k%f%b'
MODE_INDICATOR_REPLACE='%K{9}%F{8}%B REPLACE %k%f%b'
MODE_INDICATOR_SEARCH='%K{13}%F{8}%B SEARCH %k%f%b'
MODE_INDICATOR_VISUAL='%K{12}%F{8}%B VISUAL %k%f%b'
MODE_INDICATOR_VLINE='%K{12}%F{8}%B V-LINE %k%f%b'
'';
plugins = [
{
name = "zsh-vim-mode";
file = "zsh-vim-mode.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "softmoth";
repo = "zsh-vim-mode";
rev = "1f9953b7d6f2f0a8d2cb8e8977baa48278a31eab";
sha256 = "sha256-a+6EWMRY1c1HQpNtJf5InCzU7/RphZjimLdXIXbO6cQ=";
};
}
];
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
programs.zoxide = {
enable = true;
};
}