1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 18:21:07 +01:00
Files
niveum/configs/shells.nix

100 lines
2.9 KiB
Nix
Raw Normal View History

2019-03-15 07:10:50 +01:00
{ pkgs, lib, ... }:
let
zsh-plugins-file =
pkgs.writeText "zsh_plugins.txt" (lib.concatStringsSep "\n" [
"sharat87/zsh-vim-mode"
"Tarrasch/zsh-mcd"
"mafredri/zsh-async"
"zsh-users/zsh-completions"
"caarlos0/ports kind:path"
"Tarrasch/zsh-functional"
"zsh-users/zsh-history-substring-search"
]);
zsh-plugins =
let package = {pkgs}:
pkgs.stdenv.mkDerivation rec {
name = "zsh-plugins";
phases = [ "configurePhase" "installPhase" ];
buildInputs = with pkgs; [ antibody git ];
configurePhase = ''
export GIT_SSL_CAINFO=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt
export SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt
'';
installPhase = ''
mkdir -p $out/.cache
XDG_CACHE_HOME=$out/.cache antibody bundle < ${zsh-plugins-file} > $out/zsh_plugins.sh
'';
};
in pkgs.callPackage package {};
in {
2019-01-30 17:37:05 +01:00
environment.shellAliases = {
2019-03-12 19:21:22 +01:00
ns = "nix-shell --run zsh";
2019-03-15 07:10:50 +01:00
niveum-switch = "sudo -i nixos-rebuild --fast switch";
niveum-upgrade = "sudo -i nix-channel --update && sudo -i nixos-rebuild switch";
2019-01-30 17:37:05 +01:00
nixi = ''nix repl "<nixpkgs>"'';
2019-03-20 19:18:23 +01:00
grep = "grep --color=auto";
rm = "rm -i";
cp = "cp -i";
mv = "mv -i";
2019-01-30 17:37:05 +01:00
};
2018-12-20 00:25:50 +01:00
environment.interactiveShellInit = "export PATH=$PATH:$HOME/.local/bin:$HOME/.cargo/bin";
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestions.enable = true;
syntaxHighlighting.enable = true;
2019-03-20 19:18:23 +01:00
syntaxHighlighting.highlighters = [ "main" "brackets" "pattern" "line" ];
interactiveShellInit = ''
2019-03-20 19:18:23 +01:00
setopt INTERACTIVE_COMMENTS CORRECT
setopt MULTIOS
setopt AUTO_NAME_DIRS
2019-03-20 19:18:23 +01:00
setopt CDABLE_VARS
setopt HIST_IGNORE_ALL_DUPS
setopt VI
unsetopt NOMATCH
export KEYTIMEOUT=1
2019-03-20 19:18:23 +01:00
hash -d nixos=/etc/nixos
autoload -U zmv run-help
take() {
mkdir $1
cd $1
}
'';
promptInit = ''
2019-03-20 19:18:23 +01:00
autoload -Uz vcs_info
zstyle ':vcs_info:*:' enable git
zstyle ':vcs_info:*:' check-for-changes true
zstyle ':vcs_info:*:' stagedstr '%F{green}+%f'
zstyle ':vcs_info:*:' unstagedstr '%F{red}~%f'
zstyle ':vcs_info:*:' use-prompt-escapes true
zstyle ':vcs_info:*:' formats "%c%u%F{cyan}%b%f"
zstyle ':vcs_info:*:' actionformats "(%a) %c%u%F{cyan}%b%f"
precmd () {
vcs_info
RPROMPT="$vcs_info_msg_0_"
if [[ -n $IN_NIX_SHELL ]]; then
PROMPT='%B%~%b %(?.%F{green}.%F{red})λ%f '
else
PROMPT='%B%~%b %(?.%F{green}.%F{red})%#%f '
fi
}
'';
};
programs.bash = {
promptInit = ''PS1="$(tput bold)\w \$([[ \$? == 0 ]] && echo \"\[\033[1;32m\]\" || echo \"\[\033[1;31m\]\")\$$(tput sgr0) "'';
interactiveShellInit = ''
set -o vi
'';
enableCompletion = true;
};
}