2023-09-12 08:44:05 -06:00
|
|
|
{ ... }: {
|
2022-08-25 12:21:35 -06:00
|
|
|
config = {
|
|
|
|
programs.zsh.interactiveShellInit = ''
|
|
|
|
export NO_COLOR=1
|
|
|
|
# That sweet sweet ^W
|
|
|
|
WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
|
|
|
|
|
|
|
|
autoload -Uz compinit && compinit
|
|
|
|
|
|
|
|
set -o emacs
|
|
|
|
|
|
|
|
'';
|
|
|
|
programs.zsh.promptInit = ''
|
|
|
|
autoload -U promptinit && promptinit
|
|
|
|
autoload -Uz vcs_info
|
|
|
|
autoload -Uz colors && colors
|
|
|
|
|
|
|
|
setopt prompt_subst
|
|
|
|
#setopt prompt_sp
|
|
|
|
|
|
|
|
zstyle ':vcs_info:*' enable git hg cvs
|
|
|
|
zstyle ':vcs_info:*' get-revision true
|
|
|
|
zstyle ':vcs_info:git:*' check-for-changes true
|
|
|
|
zstyle ':vcs_info:git:*' formats '(%b)'
|
|
|
|
|
|
|
|
precmd_vcs_info() { vcs_info }
|
|
|
|
precmd_functions+=( precmd_vcs_info )
|
|
|
|
|
|
|
|
prompt_char() {
|
|
|
|
if [ -z "$IN_NIX_SHELL" ]; then
|
|
|
|
echo -n "%#"
|
|
|
|
else
|
|
|
|
echo -n ";"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-10-16 08:22:31 -06:00
|
|
|
export NETRC=/run/secrets/netrc
|
2022-10-16 08:19:31 -06:00
|
|
|
|
2022-08-25 12:21:35 -06:00
|
|
|
PROMPT='%n@%m[%(?.%{$fg[default]%}.%{$fg[red]%})%?%{$reset_color%}]:%~$vcs_info_msg_0_$(prompt_char) '
|
|
|
|
|
2024-05-15 10:51:15 -06:00
|
|
|
ni() {
|
|
|
|
if [ "$#" -eq 0 ]; then
|
|
|
|
echo "please specify packages to install"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
opts=()
|
|
|
|
for i in $@; do
|
|
|
|
opts+="nixpkgs#$i"
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "==> Installing: $opts"
|
|
|
|
nix shell $opts
|
|
|
|
}
|
|
|
|
|
2023-02-28 08:07:43 -07:00
|
|
|
go_update_deps() {
|
2023-06-07 07:51:09 -06:00
|
|
|
for i in $(go list -m -f '{{if not (or .Indirect .Main)}}{{.Path}}{{end}}' all); do
|
|
|
|
go get -u $i
|
|
|
|
done
|
|
|
|
go mod tidy
|
|
|
|
}
|
|
|
|
|
2024-05-03 13:26:13 -06:00
|
|
|
xin-update() {
|
|
|
|
SUDO_CMD=""
|
|
|
|
[[ $(id -u) == 0 ]] || SUDO_CMD="sudo"
|
|
|
|
$SUDO_CMD nixos-rebuild switch --flake github:qbit/xin --refresh |& nom
|
|
|
|
}
|
|
|
|
|
2023-06-07 07:51:09 -06:00
|
|
|
mkhash() {
|
|
|
|
nix hash to-sri --type sha256 $(nix-prefetch-url --type sha256 "$1")
|
2023-02-28 08:07:43 -07:00
|
|
|
}
|
|
|
|
|
2022-08-25 12:21:35 -06:00
|
|
|
k() {
|
|
|
|
''${K_DEBUG}
|
|
|
|
if [ -z $1 ]; then
|
|
|
|
echo $PWD >> ~/.k
|
|
|
|
else
|
|
|
|
K=~/.k
|
|
|
|
case $1 in
|
|
|
|
clean) sort -u $K -o ''${K};;
|
|
|
|
rm) sed -i -E "\#^''${2:-''${PWD}}\$#d" ''${K};;
|
|
|
|
ls) cat ''${K};;
|
|
|
|
*) cd "$(grep -e "$1" ''${K} | head -n 1)";;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
eval "$(direnv hook zsh)"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|