nix-config/home/zsh/macos.nix

72 lines
1.8 KiB
Nix
Raw Normal View History

2022-01-18 09:32:55 +01:00
{ config, pkgs, ... }:
{
imports = [ ./common.nix ];
programs.starship = {
settings = {
gcloud = {
disabled = false;
format = ''
on [$symbol$account(@$domain)(($region))]($style)
'';
symbol = " ";
};
python = {
disabled = true;
symbol = "";
format = ''
via [$symbol$pyenv_prefix($version )(($virtualenv) )]($style)
'';
python_binary = [
"python"
"python2"
"python3"
"/usr/bin/python"
"/usr/local/bin/python3"
];
};
};
};
programs.zsh = {
enableVteIntegration = false;
initExtra = ''
autoload -U history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^[[A" history-beginning-search-backward-end
bindkey "^[[B" history-beginning-search-forward-end
# setopt PROMPT_CR
# setopt PROMPT_SP
# export PROMPT_EOL_MARK=""
unsetopt PROMPT_SP
precmd() {
precmd() {
echo
}
}
VENV_DIR="${config.home.homeDirectory}/virtualenvs"
export WORKON_HOME="''${VENV_DIR}"
function activate-venv() {
local selected_env
selected_env=$(
${pkgs.findutils}/bin/find \
"''${VENV_DIR}" \
-maxdepth 1 \
-mindepth 1 \
-type d \
-exec basename {} \; | \
${pkgs.fzf}/bin/fzf
)
[ -n "$selected_env" ] && \
source "''${VENV_DIR}/''${selected_env}/bin/activate"
}
export LANG=en_US.utf8
export LC_ALL=en_US.UTF-8
'';
};
}