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