134 lines
3.2 KiB
Nix
134 lines
3.2 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
just-plugin = let
|
|
plugin_file = pkgs.writeText "_just" ''
|
|
#compdef just
|
|
#autload
|
|
|
|
alias justl="\just --list"
|
|
alias juste="\just --evaluate"
|
|
|
|
local subcmds=()
|
|
|
|
while read -r line ; do
|
|
if [[ ! $line == Available* ]] ;
|
|
then
|
|
subcmds+=(''${line/[[:space:]]*\#/:})
|
|
fi
|
|
done < <(just --list)
|
|
|
|
_describe 'command' subcmds
|
|
'';
|
|
in
|
|
pkgs.stdenv.mkDerivation {
|
|
name = "just-completions";
|
|
version = "0.1.0";
|
|
phases = "installPhase";
|
|
installPhase = ''
|
|
PLUGIN_PATH=$out/share/oh-my-zsh/plugins/just
|
|
mkdir -p $PLUGIN_PATH
|
|
cp ${plugin_file} $PLUGIN_PATH/_just
|
|
chmod --recursive a-w $out
|
|
'';
|
|
};
|
|
in {
|
|
programs.zsh = {
|
|
enable = true;
|
|
|
|
profileExtra = ''
|
|
. "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh"
|
|
'';
|
|
|
|
# will be called again by oh-my-zsh
|
|
enableCompletion = false;
|
|
enableAutosuggestions = true;
|
|
initExtra = let
|
|
inNixShell = ''$([[ -n "$IN_NIX_SHELL" ]] && printf " 🐚")'';
|
|
in ''
|
|
if test ! -n "$TMPDIR" -a -z "$TMPDIR"; then
|
|
unset TMPDIR
|
|
fi
|
|
|
|
if test ! -n "$TMP" -a -z "$TMP"; then
|
|
unset TMP
|
|
fi
|
|
|
|
|
|
PROMPT='%F{%(!.red.green)}%n%f@%m %(?.%F{green}✓%f.%F{red}✗ ($?%))%f %F{blue}%~%f${inNixShell}%F{magenta}$(git_prompt_info)%f$prompt_newline%_%F{%(!.red.green)}$(prompt_char)%f '
|
|
RPROMPT=""
|
|
|
|
# Automatic rehash
|
|
zstyle ':completion:*' rehash true
|
|
|
|
if [ -f $HOME/.shrc.d/sh_aliases ]; then
|
|
. $HOME/.shrc.d/sh_aliases
|
|
fi
|
|
|
|
${
|
|
if builtins.hasAttr "homeshick" pkgs
|
|
then ''
|
|
source ${pkgs.homeshick}/homeshick.sh
|
|
fpath=(${pkgs.homeshick}/completions $fpath)
|
|
''
|
|
else ""
|
|
}
|
|
|
|
# Disable intercepting of ctrl-s and ctrl-q as flow control.
|
|
stty stop ''' -ixoff -ixon
|
|
|
|
# don't cd into directories when executed
|
|
unsetopt AUTO_CD
|
|
|
|
# print lines without termination
|
|
setopt PROMPT_CR
|
|
setopt PROMPT_SP
|
|
export PROMPT_EOL_MARK=""
|
|
|
|
${lib.optionalString config.services.gpg-agent.enable ''
|
|
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gnupg/S.gpg-agent.ssh"
|
|
''}
|
|
|
|
${lib.optionalString config.programs.neovim.enable ''
|
|
export EDITOR="nvim"
|
|
''}
|
|
'';
|
|
|
|
plugins = [
|
|
{
|
|
name = "zsh-autosuggestions";
|
|
src = pkgs.zsh-autosuggestions;
|
|
}
|
|
{
|
|
name = "enhancd";
|
|
file = "init.sh";
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "b4b4r07";
|
|
repo = "enhancd";
|
|
rev = "v2.5.1";
|
|
sha256 = "sha256-kaintLXSfLH7zdLtcoZfVNobCJCap0S/Ldq85wd3krI=";
|
|
};
|
|
}
|
|
{
|
|
name = "pass";
|
|
src = "${pkgs.oh-my-zsh}/share/oh-my-zsh/plugins/pass";
|
|
}
|
|
{
|
|
name = "minikube";
|
|
src = "${pkgs.oh-my-zsh}/share/oh-my-zsh/plugins/minikube";
|
|
}
|
|
{
|
|
name = "just";
|
|
src = "${just-plugin}/share/oh-my-zsh/plugins/just";
|
|
}
|
|
];
|
|
oh-my-zsh = {
|
|
enable = true;
|
|
theme = "tjkirch";
|
|
plugins = ["git" "sudo"];
|
|
};
|
|
};
|
|
}
|