mirror of
https://github.com/kmein/niveum
synced 2026-03-17 02:31:09 +01:00
shell: add aliases
This commit is contained in:
@@ -1,69 +1,42 @@
|
|||||||
{ pkgs, ... }:
|
{ 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 {
|
||||||
environment.shellAliases = {
|
environment.shellAliases = {
|
||||||
ns = "nix-shell --run zsh";
|
ns = "nix-shell --run zsh";
|
||||||
|
niveum-switch = "sudo -i nixos-rebuild --fast switch";
|
||||||
|
niveum-upgrade = "sudo -i nix-channel --update && sudo -i nixos-rebuild switch";
|
||||||
":r" = ''echo "You stupid!"'';
|
":r" = ''echo "You stupid!"'';
|
||||||
nixi = ''nix repl "<nixpkgs>"'';
|
nixi = ''nix repl "<nixpkgs>"'';
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.interactiveShellInit = "export PATH=$PATH:$HOME/.local/bin:$HOME/.cargo/bin";
|
environment.interactiveShellInit = "export PATH=$PATH:$HOME/.local/bin:$HOME/.cargo/bin";
|
||||||
|
|
||||||
programs.fish = {
|
|
||||||
enable = false;
|
|
||||||
interactiveShellInit = ''
|
|
||||||
function take
|
|
||||||
mkdir $argv
|
|
||||||
and cd $argv[-1]
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
promptInit = ''
|
|
||||||
function fish_right_prompt --description 'Write out the right prompt'
|
|
||||||
set -g __fish_git_prompt_show_informative_status 1
|
|
||||||
set -g __fish_git_prompt_hide_untrackedfiles 1
|
|
||||||
|
|
||||||
set -g __fish_git_prompt_color_branch magenta
|
|
||||||
set -g __fish_git_prompt_showupstream "informative"
|
|
||||||
set -g __fish_git_prompt_char_upstream_ahead "↑"
|
|
||||||
set -g __fish_git_prompt_char_upstream_behind "↓"
|
|
||||||
set -g __fish_git_prompt_char_upstream_prefix ""
|
|
||||||
|
|
||||||
set -g __fish_git_prompt_char_stagedstate "●"
|
|
||||||
set -g __fish_git_prompt_char_dirtystate "✚"
|
|
||||||
set -g __fish_git_prompt_char_untrackedfiles "…"
|
|
||||||
set -g __fish_git_prompt_char_conflictedstate "✖"
|
|
||||||
set -g __fish_git_prompt_char_cleanstate "✔"
|
|
||||||
|
|
||||||
set -g __fish_git_prompt_color_dirtystate blue
|
|
||||||
set -g __fish_git_prompt_color_stagedstate yellow
|
|
||||||
set -g __fish_git_prompt_color_invalidstate red
|
|
||||||
set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
|
|
||||||
set -g __fish_git_prompt_color_cleanstate green
|
|
||||||
echo -n -s (__fish_git_prompt)
|
|
||||||
end
|
|
||||||
|
|
||||||
function fish_prompt --description 'Write out the prompt'
|
|
||||||
set color_cwd blue
|
|
||||||
set -l suffix
|
|
||||||
set -l color_suffix
|
|
||||||
switch "$USER"
|
|
||||||
case root toor
|
|
||||||
set suffix '#'
|
|
||||||
case '*'
|
|
||||||
set suffix '>'
|
|
||||||
if test $IN_NIX_SHELL
|
|
||||||
set suffix 'λ'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if test $status -eq 0
|
|
||||||
set color_suffix green
|
|
||||||
else
|
|
||||||
set color_suffix red
|
|
||||||
end
|
|
||||||
echo -n -s (set_color --bold $color_cwd) (prompt_pwd) (set_color normal) " " (set_color --bold $color_suffix) "$suffix " (set_color normal)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
@@ -80,6 +53,7 @@
|
|||||||
bindkey '^w' backward-kill-word
|
bindkey '^w' backward-kill-word
|
||||||
bindkey '^r' history-incremental-search-backward
|
bindkey '^r' history-incremental-search-backward
|
||||||
'';
|
'';
|
||||||
|
# source ${zsh-plugins}/zsh_plugins.sh
|
||||||
promptInit = ''
|
promptInit = ''
|
||||||
PROMPT=$'%{\e[1m%}%~%{\e[0m%}'
|
PROMPT=$'%{\e[1m%}%~%{\e[0m%}'
|
||||||
PROMPT="$PROMPT \$([[ \$? == 0 ]] && echo \"%{$fg_bold[green]%}\" || echo \"%{$fg_bold[red]%}\")\$(test $IN_NIX_SHELL && echo λ || echo %#)%{$reset_color%} "
|
PROMPT="$PROMPT \$([[ \$? == 0 ]] && echo \"%{$fg_bold[green]%}\" || echo \"%{$fg_bold[red]%}\")\$(test $IN_NIX_SHELL && echo λ || echo %#)%{$reset_color%} "
|
||||||
|
|||||||
Reference in New Issue
Block a user