This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

get zsh from tools

+179 -156
+148 -143
2configs/zsh.nix
··· 1 - { pkgs, ... }: 1 + { pkgs, self, ... }: 2 2 { 3 - environment.systemPackages = with pkgs; [ 4 - atuin 5 - direnv 6 - fzf 7 - ]; 8 - environment.variables.ATUIN_CONFIG_DIR = toString ( 9 - pkgs.writeTextDir "/config.toml" '' 10 - auto_sync = true 11 - update_check = false 12 - sync_address = "http://green.r:8888" 13 - sync_frequency = 0 14 - style = "compact" 15 - '' 16 - ); 17 - programs.zsh = { 18 - enable = true; 19 - shellInit = '' 20 - #disable config wizard 21 - zsh-newuser-install() { :; } 22 - ''; 23 - interactiveShellInit = '' 24 - unsetopt nomatch # no matches found urls 25 - setopt autocd extendedglob 26 - bindkey -e 27 - 28 - 29 - # # setopt inc_append_history 30 - # bindkey '^R' history-incremental-search-backward 31 - 32 - #C-x C-e open line in editor 33 - autoload -z edit-command-line 34 - zle -N edit-command-line 35 - bindkey "^X^E" edit-command-line 36 - 37 - #fzf inclusion 38 - eval "$(${pkgs.fzf}/bin/fzf --zsh)" 39 - 40 - # atuin distributed shell history 41 - export ATUIN_NOBIND="true" # disable all keybdinings of atuin 42 - eval "$(atuin init zsh)" 43 - bindkey '^r' _atuin_search_widget # bind ctrl+r to atuin 44 - # use zsh only session history 45 - fc -p 46 - 47 - #completion magic 48 - autoload -Uz compinit 49 - compinit 50 - zstyle ':completion:*' menu select 51 - 52 - #enable automatic rehashing of $PATH 53 - zstyle ':completion:*' rehash true 54 - 55 - # fancy mv which interactively gets the second argument if not given 56 - function mv() { 57 - if [[ "$#" -ne 1 ]] || [[ ! -e "$1" ]]; then 58 - command mv -v "$@" 59 - return 60 - fi 61 - 62 - newfilename="$1" 63 - vared newfilename 64 - command mv -v -- "$1" "$newfilename" 65 - } 66 - 67 - #beautiful colors 68 - eval $(dircolors -b ${ 69 - pkgs.fetchFromGitHub { 70 - owner = "trapd00r"; 71 - repo = "LS_COLORS"; 72 - rev = "a75fca8545f91abb8a5f802981033ef54bf1eac0"; 73 - sha256 = "1lzj0qnj89mzh76ha137mnz2hf86k278rh0y9x124ghxj9yqsnb4"; 74 - } 75 - }/LS_COLORS) 76 - zstyle ':completion:*:default' list-colors ''${(s.:.)LS_COLORS} 77 - 78 - #emacs bindings 79 - bindkey "[7~" beginning-of-line 80 - bindkey "[8~" end-of-line 81 - bindkey "Oc" emacs-forward-word 82 - bindkey "Od" emacs-backward-word 83 - 84 - # direnv integration 85 - eval "$(${pkgs.direnv}/bin/direnv hook zsh)" 86 - ''; 87 - promptInit = '' 88 - autoload -U promptinit 89 - promptinit 90 - 91 - p_error='%(?..%F{red}%?%f )' 92 - t_error='%(?..%? )' 93 - 94 - case $UID in 95 - 0) 96 - p_username='%F{red}root%f' 97 - t_username='root' 98 - ;; 99 - 1337) 100 - p_username="" 101 - t_username="" 102 - ;; 103 - *) 104 - p_username='%F{blue}%n%f' 105 - t_username='%n' 106 - ;; 107 - esac 108 - 109 - if test -n "$SSH_CLIENT"; then 110 - p_hostname='@%F{magenta}%M%f ' 111 - t_hostname='@%M ' 112 - else 113 - p_hostname="" 114 - t_hostname="" 115 - fi 116 - 117 - #check if in nix shell 118 - if test -n "$IN_NIX_SHELL"; then 119 - p_nixshell='%F{green}[s]%f ' 120 - t_nixshell='[s] ' 121 - else 122 - p_nixshell="" 123 - t_nixshell="" 124 - fi 125 - 126 - PROMPT="$p_error$p_username$p_hostname$p_nixshell%~ " 127 - TITLE="$t_error$t_username$t_hostname$t_nixshell%~" 128 - case $TERM in 129 - (*xterm* | *rxvt*) 130 - function precmd { 131 - PROMPT_EVALED=$(print -P "$TITLE") 132 - echo -ne "\033]0;$$ $PROMPT_EVALED\007" 133 - } 134 - # This seems broken for some reason 135 - # # This is seen while the shell waits for a command to complete. 136 - # function preexec { 137 - # PROMPT_EVALED=$(print -P "$TITLE") 138 - # echo -ne "\033]0;$$ $PROMPT_EVALED $1\007" 139 - # } 140 - ;; 141 - esac 142 - ''; 143 - }; 3 + # environment.systemPackages = with pkgs; [ 4 + # atuin 5 + # direnv 6 + # fzf 7 + # ]; 8 + # environment.variables.ATUIN_CONFIG_DIR = toString ( 9 + # pkgs.writeTextDir "/config.toml" '' 10 + # auto_sync = true 11 + # update_check = false 12 + # sync_address = "http://green.r:8888" 13 + # sync_frequency = 0 14 + # style = "compact" 15 + # '' 16 + # ); 17 + # programs.zsh = { 18 + # enable = true; 19 + # shellInit = '' 20 + # #disable config wizard 21 + # zsh-newuser-install() { :; } 22 + # ''; 23 + # interactiveShellInit = '' 24 + # unsetopt nomatch # no matches found urls 25 + # setopt autocd extendedglob 26 + # bindkey -e 27 + # 28 + # 29 + # # # setopt inc_append_history 30 + # # bindkey '^R' history-incremental-search-backward 31 + # 32 + # #C-x C-e open line in editor 33 + # autoload -z edit-command-line 34 + # zle -N edit-command-line 35 + # bindkey "^X^E" edit-command-line 36 + # 37 + # #fzf inclusion 38 + # eval "$(${pkgs.fzf}/bin/fzf --zsh)" 39 + # 40 + # # atuin distributed shell history 41 + # export ATUIN_NOBIND="true" # disable all keybdinings of atuin 42 + # eval "$(atuin init zsh)" 43 + # bindkey '^r' _atuin_search_widget # bind ctrl+r to atuin 44 + # # use zsh only session history 45 + # fc -p 46 + # 47 + # #completion magic 48 + # autoload -Uz compinit 49 + # compinit 50 + # zstyle ':completion:*' menu select 51 + # 52 + # #enable automatic rehashing of $PATH 53 + # zstyle ':completion:*' rehash true 54 + # 55 + # # fancy mv which interactively gets the second argument if not given 56 + # function mv() { 57 + # if [[ "$#" -ne 1 ]] || [[ ! -e "$1" ]]; then 58 + # command mv -v "$@" 59 + # return 60 + # fi 61 + # 62 + # newfilename="$1" 63 + # vared newfilename 64 + # command mv -v -- "$1" "$newfilename" 65 + # } 66 + # 67 + # #beautiful colors 68 + # eval $(dircolors -b ${ 69 + # pkgs.fetchFromGitHub { 70 + # owner = "trapd00r"; 71 + # repo = "LS_COLORS"; 72 + # rev = "a75fca8545f91abb8a5f802981033ef54bf1eac0"; 73 + # sha256 = "1lzj0qnj89mzh76ha137mnz2hf86k278rh0y9x124ghxj9yqsnb4"; 74 + # } 75 + # }/LS_COLORS) 76 + # zstyle ':completion:*:default' list-colors ''${(s.:.)LS_COLORS} 77 + # 78 + # #emacs bindings 79 + # bindkey "[7~" beginning-of-line 80 + # bindkey "[8~" end-of-line 81 + # bindkey "Oc" emacs-forward-word 82 + # bindkey "Od" emacs-backward-word 83 + # 84 + # # direnv integration 85 + # eval "$(${pkgs.direnv}/bin/direnv hook zsh)" 86 + # ''; 87 + # promptInit = '' 88 + # autoload -U promptinit 89 + # promptinit 90 + # 91 + # p_error='%(?..%F{red}%?%f )' 92 + # t_error='%(?..%? )' 93 + # 94 + # case $UID in 95 + # 0) 96 + # p_username='%F{red}root%f' 97 + # t_username='root' 98 + # ;; 99 + # 1337) 100 + # p_username="" 101 + # t_username="" 102 + # ;; 103 + # *) 104 + # p_username='%F{blue}%n%f' 105 + # t_username='%n' 106 + # ;; 107 + # esac 108 + # 109 + # if test -n "$SSH_CLIENT"; then 110 + # p_hostname='@%F{magenta}%M%f ' 111 + # t_hostname='@%M ' 112 + # else 113 + # p_hostname="" 114 + # t_hostname="" 115 + # fi 116 + # 117 + # #check if in nix shell 118 + # if test -n "$IN_NIX_SHELL"; then 119 + # p_nixshell='%F{green}[s]%f ' 120 + # t_nixshell='[s] ' 121 + # else 122 + # p_nixshell="" 123 + # t_nixshell="" 124 + # fi 125 + # 126 + # PROMPT="$p_error$p_username$p_hostname$p_nixshell%~ " 127 + # TITLE="$t_error$t_username$t_hostname$t_nixshell%~" 128 + # case $TERM in 129 + # (*xterm* | *rxvt*) 130 + # function precmd { 131 + # PROMPT_EVALED=$(print -P "$TITLE") 132 + # echo -ne "\033]0;$$ $PROMPT_EVALED\007" 133 + # } 134 + # # This seems broken for some reason 135 + # # # This is seen while the shell waits for a command to complete. 136 + # # function preexec { 137 + # # PROMPT_EVALED=$(print -P "$TITLE") 138 + # # echo -ne "\033]0;$$ $PROMPT_EVALED $1\007" 139 + # # } 140 + # ;; 141 + # esac 142 + # ''; 143 + # }; 144 144 environment.shellAliases.ns = "nix-shell --command zsh"; 145 - 146 145 users.defaultUserShell = "/run/current-system/sw/bin/zsh"; 146 + environment.systemPackages = [ 147 + pkgs.atuin 148 + pkgs.fzf 149 + pkgs.direnv 150 + self.packages.${pkgs.system}.zsh 151 + ]; 147 152 }
+31 -13
tools/zsh.nix
··· 10 10 # Bind gpg-agent to this TTY if gpg commands are used. 11 11 export GPG_TTY=$(tty) 12 12 13 + # show how long a command takes 14 + ZSH_COMMAND_TIME_MIN_SECONDS=3 15 + ZSH_COMMAND_TIME_EXCLUDE=(vim) 16 + ZSH_COMMAND_TIME_MSG="took: %s sec" 17 + source ${ 18 + pkgs.fetchFromGitHub { 19 + owner = "popstas"; 20 + repo = "zsh-command-time"; 21 + rev = "803d26eef526bff1494d1a584e46a6e08d25d918"; 22 + hash = "sha256-ndHVFcz+XmUW0zwFq7pBXygdRKyPLjDZNmTelhd5bv8="; 23 + } 24 + }/command-time.plugin.zsh 13 25 14 26 unsetopt nomatch # no matches found urls 15 27 setopt autocd extendedglob ··· 25 37 source ${pkgs.fzf}/share/fzf/key-bindings.zsh 26 38 27 39 # atuin distributed shell history 28 - export ATUIN_CONFIG_DIR=${pkgs.writeTextDir "/config.toml" '' 29 - auto_sync = true 30 - update_check = false 31 - sync_address = "http://green.r:8888" 32 - sync_frequency = 0 33 - style = "compact" 34 - ''}; 35 - export ATUIN_NOBIND="true" # disable all keybdinings of atuin 36 - eval "$(atuin init zsh)" 37 - bindkey '^r' _atuin_search_widget # bind ctrl+r to atuin 38 - # use zsh only session history 39 - fc -p 40 + if type -p atuin >/dev/null; then 41 + export ATUIN_CONFIG_DIR=${pkgs.writeTextDir "/config.toml" '' 42 + auto_sync = true 43 + update_check = false 44 + sync_address = "http://green.r:8888" 45 + sync_frequency = 0 46 + style = "compact" 47 + ''}; 48 + export ATUIN_NOBIND="true" # disable all keybdinings of atuin 49 + eval "$(${pkgs.atuin}/bin/atuin init zsh)" # TODO make this optional? 50 + bindkey '^r' _atuin_search_widget # bind ctrl+r to atuin 51 + # use zsh only session history 52 + fc -p 53 + fi 40 54 41 55 #completion magic 42 56 autoload -Uz compinit ··· 166 180 { 167 181 packages.shell = pkgs.writeScriptBin "shell" '' 168 182 #!/bin/sh 169 - zdotdir=$(mktemp -d) 183 + export ZDOTDIR=${pkgs.writeTextDir "/.zshrc" zshrc} 184 + exec ${pkgs.zsh}/bin/zsh "$@" 185 + ''; 186 + packages.zsh = pkgs.writeScriptBin "zsh" '' 187 + #!/bin/sh 170 188 export ZDOTDIR=${pkgs.writeTextDir "/.zshrc" zshrc} 171 189 exec ${pkgs.zsh}/bin/zsh "$@" 172 190 '';