Skip to content

Instantly share code, notes, and snippets.

@dejanr

dejanr/zsh.nix Secret

Created December 6, 2019 13:08
Show Gist options
  • Save dejanr/809b0bfa210ef27595ae77aa6e57ee2f to your computer and use it in GitHub Desktop.
Save dejanr/809b0bfa210ef27595ae77aa6e57ee2f to your computer and use it in GitHub Desktop.
{ pkgs, lib, ... }:
{
environment.systemPackages = with pkgs; [
fzf # A command-line fuzzy finder written in Go
powerline-fonts # Pre-patched and adjusted fonts for usage with the Powerline plugin.
];
programs.zsh = {
autosuggestions.enable = true;
enable = true;
enableCompletion = true;
histSize = 9999;
syntaxHighlighting.enable = true;
vteIntegration = true;
loginShellInit = ''
eval "$(direnv hook zsh)"
'';
promptInit = ''
function spaceship_nix_shell(){
if [[ -n "$IN_NIX_SHELL" ]]; then
spaceship::section "cyan" "nix"
fi
}
export SPACESHIP_PROMPT_ORDER=(
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
package # Package version
node # Node.js section
exec_time # Execution time
line_sep # Line break
jobs # Background jobs indicator
exit_code # Exit code section
char # Prompt character
)
export SPACESHIP_RPROMPT_ORDER=(
vi_mode nix_shell
)
export SPACESHIP_CHAR_SYMBOL="λ "
export SPACESHIP_CHAR_COLOR_SUCCESS=white
autoload -U promptinit select-word-style && promptinit && prompt spaceship
'';
};
programs.zsh.ohMyZsh = {
enable = true;
theme = "spaceship";
plugins = [
"docker"
"extract"
"vi-mode"
"git"
"gitfast"
"git-extras"
"httpie"
"systemd"
"sudo"
"tig"
"tmux"
"nix"
];
customPkgs = with pkgs; [
spaceship-prompt # A Zsh prompt for Astronauts
nix-zsh-completions # ZSH completions for Nix, NixOS, and NixOps
fzf-zsh # ZSH completions for Nix, NixOS, and NixOps
zsh-nix-shell
];
};
users.users.dejanr.shell = "/run/current-system/sw/bin/zsh";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment