aboutsummaryrefslogtreecommitdiffstats
path: root/ginaz/home.nix
blob: c2f84f7fd4f1901c812bd2cc9b9732b5e6e13396 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
{ config, pkgs, ... }:

{
  gtk = {
    enable = true;
    gtk3.extraConfig.gtk-application-prefer-dark-theme = true;
    gtk4.extraConfig.gtk-application-prefer-dark-theme = true;
  };

  home.username = "nipsy";
  home.homeDirectory = "/home/nipsy";
  home.stateVersion = "23.11";

  programs.git = {
    enable = true;
    userName = "Mark Nipper";
    userEmail = "nipsy@bitgnome.net";
    extraConfig.pull.rebase = true;
  };

  programs.home-manager.enable = true;

  programs.tmux = {
    enable = true;
    extraConfig = ''
      #set-option -ga terminal-overrides ",st-256color:Tc"
      set -as terminal-features ",foot*:RGB"
      set -as terminal-features ",st-256color:RGB"
      set -ga monitor-bell on
      set -g history-limit 100000
      set -g bell-action any
      #set -g bell-on-alert on
      
      set -s escape-time 0
      
      setw -g aggressive-resize on
      setw -g wrap-search off
      
      bind-key a send-prefix
      bind-key k kill-session
      bind-key H pipe-pane -o 'cat >> ~/.tmux.log.#h-#S-#I-#P'
      
      #bind-key m \
      #	set -g mouse on \;\
      #	display 'Mouse: ON'
      #bind M \
      #	set -g mouse off \;\
      #	display 'Mouse: OFF'
      
      # vim-like copypaste mode
      set-window-option -g mode-keys vi
      bind-key -T copy-mode-vi v send -X begin-selection
      bind-key -T copy-mode-vi y send -X copy-pipe "xclip -selection clipboard"
      bind-key -T copy-mode-vi C-v send -X rectangle-toggle
      bind-key P run "tmux set-buffer \"$(xclip -o -selection clipboard)\"; tmux paste-buffer"
      
      # don't exit copy mode after selection
      #set -s mouse on
      #bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection -x
    '';
  };

  programs.vim = {
    enable = true;
    extraConfig = ''
      " Handling of big files - William Natter, Tony Mechelynck and others
      " fairly certain that BufSizeThreshold is in bytes
      let g:SaveUndoLevels = &undolevels
      let g:BufSizeThreshold = 5242880
      if has("autocmd")
      	au VimEnter * let g:SaveUndoLevels = &undolevels
      	au BufReadPre * if getfsize(expand("%")) >= g:BufSizeThreshold | setlocal noswapfile | endif
      	au BufEnter * if getfsize(expand("%")) < g:BufSizeThreshold | let &undolevels=g:SaveUndoLevels | else | setlocal undolevels=-1 | endif
      	au BufEnter * if getfsize(expand("%")) < g:BufSizeThreshold | syntax on | else | syntax off | endif
      endif
      
      set mouse&
      set noautoindent	" always set autoindenting off
      
      " enable better 24-bit color support
      "let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
      "let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
      set termguicolors
      
      " If using a dark background within the editing area and syntax highlighting
      " turn on this option as well
      set background=dark
      
      if has("autocmd")
      	" Enabled file type detection
      	" Use the default filetype settings. If you also want to load indent files
      	" to automatically do language-dependent indenting add 'indent' as well.
      	filetype plugin on
      	"filetype indent on
      endif " has ("autocmd")
      
      " The following are commented out as they cause vim to behave a lot
      " different from regular vi. They are highly recommended though.
      set showcmd			" Show (partial) command in status line.
      set showmatch			" Show matching brackets.
      set ignorecase			" Do case insensitive matching
      set incsearch			" Incremental search
      "set expandtab			" replace tabs with spaces
      set smarttab			" use shiftwidth instead of tabstop at start of line
      set spell spelllang=en_us	" turn on the spell check
      
      set laststatus=2
      set statusline=%<%f%h%m%r%=%{&ff}\ %Y\ %b\ 0x%B\ \ %l,%c%V\ %P
      
      map <F5> :w<CR><bar>:!clear;go run %<CR>
      map <F6> :w<CR><bar>:%! gofmt<CR>
    '';
  };

  programs.zsh = {
    enable = true;
    initExtra = ''
umask 022

#export GOROOT="''${HOME}/.local/go"
#export GOPATH="''${HOME}/go"

#export PATH="$HOME/bin:$GOROOT/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/games:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin"
#export PATH="$HOME/bin:$GOROOT/bin:/usr/bin:/usr/sbin:/usr/games:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin"
#export PATH=~/bin::~/.local/rust/cargo/bin:/usr/bin:/usr/sbin:/usr/games:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin
export PATH=~/bin:''${PATH}

#export PS1="%B%n%b@%U%m%u/%l:%~> "
export PAGER=less
export EDITOR=vim
export BROWSER=firefox

export LC_COLLATE="C"
eval $(dircolors)
export QUOTING_STYLE="literal"

export IRCNICK="nipsy"
export IRCNAME="Mark Nipper"

export NNTPSERVER="news.giganews.com"

#export HISTFILE="$HOME/.zsh_hist"
export HISTSIZE=100000
export SAVEHIST=''${HISTSIZE}

#export COLORTERM=truecolor
export COLORFGBG="green;blue"

# fix stupid broken Java shit
export _JAVA_AWT_WM_NONREPARENTING=1

# enable pass extensions
export PASSWORD_STORE_ENABLE_EXTENSIONS=true

# set SWAYSOCK correctly
if pgrep -U nipsy -x sway >/dev/null; then
	export SWAYSOCK=/run/user/$(id -u)/sway-ipc.$(id -u).$(pgrep -x sway).sock
fi

# start sway by default if logging into tty1
if [[ -z "''${DISPLAY}" ]] && [[ $(tty) == "/dev/tty1" ]]; then

	export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)

	# set some Wayland specific variables
	export MOZ_ENABLE_WAYLAND=1
	export GDK_BACKEND=wayland
	export QT_QPA_PLATFORM=wayland
	export SDL_VIDEODRIVER=wayland
	export XDG_SESSION_TYPE=wayland

	exec sway > ~/.sway.log

fi

# if already in Wayland, update the GPG TTY so ssh-askpass will work correctly
if [[ -n "''${WAYLAND_DISPLAY}" ]]; then
	gpg-connect-agent updatestartuptty /bye >/dev/null
fi

# completion options
setopt LIST_PACKED MENU_COMPLETE
# expansion and globbing options
setopt NO_NOMATCH
# history options
setopt SHARE_HISTORY EXTENDED_HISTORY HIST_FCNTL_LOCK HIST_IGNORE_ALL_DUPS HIST_REDUCE_BLANKS HIST_SAVE_NO_DUPS
# input/output options
setopt PRINT_EXIT_VALUE RM_STAR_SILENT
# job control options
setopt LONG_LIST_JOBS NO_HUP
# zle options
setopt NO_BEEP

lsopt='--color=auto'
alias ll="ls -alFh $lsopt"
alias la="ls -aF $lsopt"
alias cal="ncal -b"
#alias grep='grep --color=always' # cannot do this as it breaks shell pipelines
alias talk='gnutalk --curses'
alias manage="tmux new-window ssh root@darkstar\; split-window -d ssh root@king\; new-window ssh root@black-sheep\; split-window -d ssh root@treebeard\; new-window ssh root@casey\; split-window -d ssh root@homer\; new-window ssh root@lilnasx\; split-window -d ssh root@trent"
alias manage-mac="tmux new-session \; source ~/.tmux/manage-mac"
alias win7="xfreerdp -x l -g 1680x1050 -u nipsy -d la-its841279wd kaitain"
alias win7-la="xfreerdp -x l -g 1680x1050 -u la-mrn447 -d austin kaitain"
#alias kubectl="~/k3s/k3s kubectl"
#alias helm="~/k3s/linux-amd64/helm"
alias lock="xscreensaver-command -lock"
alias fixkeyboard="setxkbmap -layout us -option caps:super -option compose:ralt"
alias zigup="zigup --install-dir ~/.local/zig --path-link ~/bin/zig"

#autoload -U compinit
#compinit
zstyle ':completion:*' menu select=5

bindkey -v
export KEYTIMEOUT=1

autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line

# nix
#if [ -e /home/nipsy/.nix-profile/etc/profile.d/nix.sh ]; then . /home/nipsy/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer

# The next line updates PATH for the Google Cloud SDK.
#source /home/nipsy/google-cloud-sdk/path.zsh.inc

# The next line enables bash completion for gcloud.
#source /home/nipsy/google-cloud-sdk/completion.zsh.inc

# always open tmux if interactive
[[ $- != *i* ]] && return
#[[ -z "$TMUX" ]] && (tmux -2 new-session -t default \; new-window || tmux -2 new-session -s default)
[[ -z "$TMUX" ]] && (tmux -2 attach -t default || tmux -2 new-session -s default)

# prompt/theme shit
function precmd {

	local RC=''${?}
	#local RC=''${(%)RC-%?}
	
	print -nP '\n'
	
	# current user
	if [[ ''${EUID} -eq 0 ]]; then
		print -nP '%{%S%F{red}%}%n%{%f%s%}'
	else
		print -nP '%{%F{magenta}%}%n%{%f%}'
	fi
	
	print -nP '@'
	
	# current host
	if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
		print -nP '%{%F{yellow}%}%m%{%f%}'
	else
		print -nP '%{%F{green}%}%m%{%f%}'
	fi
	
	# connected terminal
	print -nP '/%{%U%}%l%{%u%} '
	
	# cwd
	print -nP '%{%F{cyan}%}%~%{%f%} '
	
	# job count
	JOBCOUNT='%j'
	if [[ ''${(%)JOBCOUNT} -gt 0 ]]; then
		print -nP 'j=%{%F{yellow}%}%j%{%f%} '
	fi
	
	# previous return code
	if [[ ''${RC} -ne 0 ]]; then
		print -nP 'rc=%{%F{red}%}'
		echo -n "''${RC}"
		print -nP '%{%f%} '
	else
		print -nP 'rc=%{%F{green}%}'
		echo -n "''${RC}"
		print -nP '%{%f%} '
	fi
	
	# time stamp
	print -P '%{%F{cyan}%}%D{%FT%T%z}%{%f%}'

}

PS1='%# '
    '';
  };
}