Lots of big changes that I should really write a good commit message for

This commit is contained in:
Daniel Flanagan 2020-11-17 17:17:03 -06:00
parent b5bf493051
commit 8b89b25b84
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
18 changed files with 383 additions and 304 deletions

View file

@ -0,0 +1,9 @@
[Desktop Entry]
Type=Application
Version=1.0
Name=Neovim-Term
Comment=Edit files using Neovim in the Kitty terminal emulator
Path=/usr/bin
Exec=kitty nvim %f
Icon=kitty
Terminal=true

View file

@ -8,6 +8,11 @@ set $dfpbin $HOME/.config/lytedev-dotfiles/bin
set $mod Mod4
set $default_gap 0
exec initctl set-env --global SWAYSOCK="$SWAYSOCK"
exec initctl set-env --global I3SOCK="$I3SOCK"
exec initctl set-env --global WAYLAND_DISPLAY="$WAYLAND_DISPLAY"
exec initctl emit sway-session
focus_wrapping no
gaps inner $default_gap
smart_borders on|no_gaps

View file

View file

@ -24,19 +24,25 @@
prompt = false
[alias]
d = difftool
s = status
co = checkout
mm = merge master
rim = rebase -i master
a = add
A = add
b = rev-parse --symbolic-full-name HEAD
p = push
pl = pull
pf = push --force-with-lease
a = add -A
cnv = commit --no-verify
canv = commit --no-verify
c = commit
cm = commit -m
cnv = commit --no-verify
co = checkout
d = diff
ds = diff --staged
dt = difftool
l = log --pretty=format:'%h %ad%x09%an%x09%s' --date=short
ls = ls-files
mm = merge master
p = push
pf = push --force-with-lease
pl = pull
rim = rebase -i master
s = status
sur = submodule update --remote
[merge]
tool = nvimdiff

View file

@ -23,6 +23,7 @@ call plug#begin($vimdir.'/plugged')
Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings
Plug 'tpope/vim-sleuth' " try and detect indent method
Plug 'vim-scripts/LargeFile' " gracefully handle very large files
Plug 'vim-scripts/restore_view.vim' " persistent buffer views
Plug 'nathanaelkane/vim-indent-guides' " indentation guides
Plug 'christoomey/vim-tmux-navigator' " allow window navigation to play nicely with tmux
Plug 'tpope/vim-commentary' " toggle comments in code easily
@ -60,7 +61,7 @@ set spellfile=$vimdir/spell/en.utf-8.add
set ignorecase smartcase incsearch wrapscan hlsearch
set foldmethod=syntax foldlevel=99 foldnestmax=10 foldlevelstart=99 " TODO: get good at folding
set noautowrite autochdir autoread
set nomodeline noshowmode noshowcmd laststatus=0 " TODO: custom modeline and buffer list?
set nomodeline noshowmode noshowcmd laststatus=2 noruler
set clipboard+=unnamedplus
set t_Co=256
let &fcs = 'eob: '
@ -75,6 +76,9 @@ hi IndentGuidesEven ctermbg=18
hi Normal ctermbg=NONE
hi ColorColumn ctermbg=15 ctermfg=0
hi TooLongColorColumn ctermbg=1 ctermfg=0
hi ActiveBuffer ctermbg=4 ctermfg=0
hi StatusLine ctermbg=18 ctermfg=7
hi StatusLineNC ctermbg=18 ctermfg=7
call matchadd('ColorColumn', '\%81v', 100)
call matchadd('TooLongColorColumn', '\%121v', 200)
@ -122,19 +126,49 @@ xnoremap > >gv
let mapleader = "\<Space>"
nnoremap <silent> <leader>r :source $vimdir/init.vim<CR>:echo 'Reloaded init.vim'<CR>
nnoremap <silent> <leader>w :bd<CR>
nnoremap <leader>h :b#<CR>
nnoremap <leader>k :bnext<CR>
nnoremap <leader>j :bprevious<CR>
nnoremap <silent> <leader>h :b#<CR>
nnoremap <silent> <leader>k :bnext<CR>
nnoremap <silent> <leader>j :bprevious<CR>
nnoremap <leader>/ :let @/ = ""<CR>:<BACKSPACE>
nnoremap <leader>t :split<CR>:term<CR>:resize 24<CR>:startinsert<CR>
tnoremap <C-w> <C-\><C-n>:q!<CR>
au BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g'\""
\ | endif
au FileType fzf tnoremap <Esc> <C-c><C-c>
function! NeatFoldText()
" TODO: WIP
let lines_count = v:foldend - v:foldstart + 1
let foldchar = matchstr(&fillchars, 'fold:\zs.')
let foldtextstart = strpart('^' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3)
let foldtextend = printf("%s %".(winwidth(0)-20)."dL", foldtextstart, getline(v:foldstart), lines_count)
let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn
return printf("%s%d", substitute(getline(v:foldstart), "^.", ">"), lines_count)
endfunction
set foldtext=NeatFoldText()
" TODO: only update this portion when needed?
function! StatusLineBufferByNum(_, bufnum)
let l:prefix = '%#InactiveBuffer#'
let l:suffix = '%* '
let l:bufinfo = getbufinfo(a:bufnum)[0]
if l:bufinfo.listed == 0
return '%*'
end
if l:bufinfo['hidden'] == 0 && index(l:bufinfo['windows'], g:statusline_winid) >= 0
let l:prefix = '%#ActiveBuffer# '
let l:suffix = ' %* '
endif
return l:prefix . fnamemodify(bufname(a:bufnum), ':t') . l:suffix
endfunction
function! StatusLineBuffers()
return join(map(nvim_list_bufs(), function("StatusLineBufferByNum")), '')
endfunction
function! StatusLine()
return StatusLineBuffers() . '%*%=%c,%l/%L (%p%%)'
endfunction
set statusline=%!StatusLine()
luafile $vimdir/lsp.lua

View file

@ -1,4 +1,9 @@
local lsp = require('lspconfig')
local homedir = os.getenv('HOME')
require 'nvim_lsp'.elixirls.setup{
cmd = { homedir..'/../code/open-source/elixir-ls/release/language_server.sh' };
local ossdir = homedir..'/../code/open-source'
lsp.elixirls.setup{
-- TODO: git clone and compile if needed
-- preferably in a background thread with messages
cmd = { ossdir..'/elixir-ls/release/language_server.sh' }
}

View file

@ -1,6 +1,6 @@
#!/usr/bin/env fish
# ls aliases
# TODO: exa?
alias lk 'ls -lSr' # order by filesize reversed
alias lt 'ls -ltr' # order by file modified time
alias lc 'ls -ltcr' # order by filectime
@ -10,9 +10,10 @@ alias l 'ls -h --color --group-directories-first' # same as above
alias ll 'ls -lv --group-directories-first' # non-flat view
alias la 'll -A' # show all
# other file aliases
# TODO: cat > bat
alias tree 'tree -Csuh'
alias f fzf
alias t "tmux"
alias rcp 'rsync -r -ah --progress'
alias vltl "$EDITOR (ltl)"
@ -57,47 +58,13 @@ alias ....... "d ../../../../../.."
alias ........ "d ../../../../../../.."
alias ......... "d ../../../../../../../.."
# tmux aliases
alias tmnew "tmux new -s"
alias tmls "tmux list-sessions | rg --color never -o '^(.*?):.*?\(.*?\)(.*)\$' -r '\$1\$2'"
alias tmatt "tmux attach -t"
alias tms "tmatt (tmls | fzf | field 1)"
function tmux-attach-or-new
tmux attach -t $argv || tmux new -s $argv
end
alias tu "tmux-attach-or-new utils"
alias tmon "tmux-attach-or-new monitoring"
alias tcom "tmux-attach-or-new comms"
alias tm "tmux-attach-or-new music"
alias tdf "tmux attach -t dotfiles || tmux new -s dotfiles -c $DOTFILES_PATH"
alias tn "tmux attach -t notes || tmux new -s notes -c $NOTES_PATH"
# git aliases
# TODO: make these git aliases in the gitconfig?
function g
function g -w git
if scount $argv
git $argv
else
git status
end
end
alias gs "git status"
alias gd "git diff"
alias gds "gd --staged"
# alias gdv "git dv" # TODO: what is this?
alias gpl "git pull"
alias ga "git add"
alias gcm "git commit -m"
alias gco "git checkout"
alias gp "git push"
alias gpa "git push --all && git push --tags"
alias gpt "git push && git push --tags"
alias gpf "git push --force-with-lease"
alias gac "git add -A && git commit"
alias gacnv "git add -A && git commit --no-verify"
alias gsur "git submodule update --remote"
alias glf "git ls-files"
alias gl "git log --pretty=format:\"%h %ad%x09%an%x09%s\" --date=short"
# docker aliases
alias dlf "docker logs --tail=500 -f"
@ -111,11 +78,11 @@ function pp
end
end
alias p "ping 8.8.8.8"
alias C "clear && clear"
alias r "ranger"
alias C "clear && clear" # TODO: this should clear a tmux pane's scrollback/logs
alias r "nnn"
alias sctl "sudo systemctl"
alias sctlu "systemctl --user"
alias bt "sudo bluetoothctl"
alias bt "sudo bluetoothctl" # TODO: a vi-like tui for bluetooth would be great
alias btctl "bt"
alias resrc "source $XDG_CONFIG_HOME/fish/config.fish"
alias sc "sc-im"

View file

@ -9,9 +9,11 @@ function preprocess_pwd
test (pwd) = / && echo "/" && return 1
test (pwd) = $NICE_HOME && echo "~" && return 0
# with ellipsis
#echo "$(<<< "$p" cut -c2- | awk '{split($0,p,"/");for(k in p){if(k==length(p)){printf "/%s",p[k]}else{if(length(p[k])>'"$((MAX_PATH_PIECE_CHARS+1))"'){printf "/%.'"$((MAX_PATH_PIECE_CHARS))"'s…",p[k]}else{printf "/%s",p[k]}}}}')"
# echo "$(<<< "$p" cut -c2- | awk '{split($0,p,"/");for(k in p){if(k==length(p)){printf "/%s",p[k]}else{if(length(p[k])>'"
# $((MAX_PATH_PIECE_CHARS+1))"'){printf "/%.'"$((MAX_PATH_PIECE_CHARS))"'s…",p[k]}else{printf "/%s",p[k]}}}}')"
# without ellipsis
echo (pwd) | cut -c2- | awk '{split($0,p,"/");for(k in p){if(k==length(p)){printf "/%s",p[k]}else{printf "/%.'$MAX_PATH_PIECE_CHARS[1]'s",p[k]}}}'
echo (pwd) | cut -c2- | \
awk '{split($0,p,"/");for(k in p){if(k==length(p)){printf "/%s",p[k]}else{printf "/%.'$MAX_PATH_PIECE_CHARS[1]'s",p[k]}}}'
end
function fish_prompt
@ -29,7 +31,7 @@ function fish_prompt
else
set_color red
end
printf "$USER@$hostname"
printf %s@%s $USER (echo $hostname | cut -d '.' -f1)
end
set_color normal
printf " "

View file

@ -1,90 +1,43 @@
# ^s as prefix
unbind C-b
set -g prefix C-s
bind-key s send-prefix
# reload tmux.conf
bind-key T source-file "$HOME/.tmux.conf" \; display-message "source-file done"
unbind r
bind r source-file "$HOME/.tmux.conf"
# set -as terminal-overrides ",xterm*:smxx=\E[9m"
set -g default-terminal "screen-256color"
# sane defaults
set -g mouse on
# honestly not exactly sure?
# set -sg escape-time 1
set -g escape-time 0
# show window activity
# TODO: this needs to be properly setup - presumably with tmux-session-list
setw -g monitor-activity on
setw -g visual-bell on
setw -g bell-action other
# common window sizes
bind-key W resize-pane -x 100
bind-key f resize-pane -x 120
bind-key F resize-pane -x 125
bind-key 8 resize-pane -x 80
bind-key 2 resize-pane -y 20
# splitting
bind-key v split-window -h
bind-key b split-window
bind-key h split-window
# show tmux status bar by default with (C-s, H) to toggle it
set -g status on
set -g history-limit 102400000
bind-key T source-file "$HOME/.tmux.conf" \; display-message "Reloaded $HOME/.tmux.conf"
bind-key O display-message "#(~/.config/lytedev-dotfiles/bin/tmux-save-buffer #S)"
bind-key H set -s status
# simple session switching
bind-key j switch-client -p
bind-key h switch-client -p
bind-key k switch-client -n
bind-key l switch-client -n
# bind s run-shell "tmux new-window sh -c "$DOTFILES_PATH/bin/tmuxswitcher""
bind-key -n C-l select-pane -R
bind-key -n C-k select-pane -U
bind-key -n C-j select-pane -D
bind-key -n C-h select-pane -L
bind s run-shell "tmux new-window \"sh -c ~/.config/lytedev-dotfiles/bin/tmuxswitcher\""
# reset the working directory of the current session
bind-key P attach-session -t . -c "#{pane_current_path}" \; display-message "Reset session dir to #{pane_current_path}"
bind M-l source-file "$XDG_CONFIG_HOME/tmux/layouts/dev.tmux"
# status bar and messages
set -g default-terminal "screen-256color"
set -g mouse on
set -g escape-time 0
set -g monitor-activity on
set -g visual-bell on
set -g bell-action other
set -g mode-keys vi
set -g history-limit 102400000
set -g status on
set -g status-position bottom
set -g status-bg colour0
set -g status-fg colour8
set -g status-interval 5
set -g status-right-length 80
set -g status-right "#[fg=colour4]#W#[fg=default]#[bg=default] #H"
set -g status-left-length 200
set -g status-left "#[fg=colour7]#(~/.config/lytedev-dotfiles/bin/tmux-session-list #S)"
set -g status-left "#h:#S.#W"
set -g message-style "fg=colour7 bg=colour18"
bind-key O display-message "#(~/.config/lytedev-dotfiles/bin/tmux-save-buffer #S)"
# pane split line colors
set -g pane-active-border-style bg=black,fg=blue
set -g pane-border-style bg=black,fg=colour18
# cLocK mOdE Is sUpEr 3LeEt
set -g clock-mode-colour colour8
# windows (which I don't use much...?)
# TODO: do I have a use case for windows?
setw -g window-status-current-format ""
# vim copying
setw -g mode-keys vi
# 1-based indexing for key binding simplicity
set -g base-index 1
set -g pane-base-index 1
# custom predefined layouts
bind M-l source-file "$XDG_CONFIG_HOME/tmux/layouts/dev.tmux"
set -g window-status-current-format ""
# present a menu of urls to open from the visible pane
# TODO: fzf-ify this
@ -92,62 +45,10 @@ bind-key u capture-pane \;\
save-buffer /tmp/tmux-buffer \;\
split-window -l 10 "urlscan /tmp/tmux-buffer"
# seamlessly handle pane switching in and out of vim panes
# see GitHub repos tmux-plugins/vim-tmux-focus-events and christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t \"#{pane_tty}\" \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -T copy-mode-vi "C-h" send -X "cancel select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
# not sure about this binding? possibly switch to previous pane...?
# bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind-key -T copy-mode-vi "y" send-keys -X copy-pipe-and-cancel -X 'wl-copy'
# YANKING
# bind-key -T copy-mode-vi "y" send -X copy-selection
bind-key -T copy-mode-vi "y" send-keys -X copy-pipe-and-cancel -X 'clip'
# various control binds
bind-key n command-prompt -p "New Session:" "new-session -s '%1'"
bind-key K kill-pane
bind-key C-S-k kill-session -C
set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.config/tmux/plugins/"
# list of plugins
set -g @plugin "tmux-plugins/tpm"
set -g @plugin "tmux-plugins/tmux-sensible"
set -g @plugin "lytedev/tmux-resurrect"
set -g @plugin "lytedev/tmux-continuum"
# prefix+[ for select mode
# v for visual mode
# yank to clipboard with y
# paste with prefix+]
set -g @plugin "tmux-plugins/tmux-yank"
set -g @plugin "tmux-plugins/tmux-copycat"
set -g @plugin "tmux-plugins/tmux-sessionist"
set -g @plugin "christoomey/vim-tmux-navigator"
# plugin options
# enable continuum
set -g @continuum-restore "on"
# let continuum startup on boot
# NOTE: disabled this due to it starting up before sway socket is up and then
# sway commands do not work from within tmux
# TODO: maybe sway (or any wm) can start continuum?
# set -g @continuum-boot "on"
# bindings for tmux-resurrect
set -g @resurrect-save "C-v"
set -g @resurrect-restore "R"
# initialize tmux plugin manager
run "~/.config/tmux/plugins/tpm/tpm"
bind-key C-S-k kill-window
# attempt at integrating nested tmux sessions nicely
# bind -T root F12 \
@ -162,7 +63,3 @@ run "~/.config/tmux/plugins/tpm/tpm"
# set -u key-table \;\
# set status on \;\
# refresh-client -S
unbind-key C-p
set -g @resurrect-hook-pre-restore-pane-processes 'tmux switch-client -n && tmux kill-session -t 0'

View file

@ -58,6 +58,7 @@ pv_tags = "notify_private"
raw_messages = 256
server_buffer = merge_with_core
smart_filter = on
smart_filter_account = on
smart_filter_chghost = on
smart_filter_delay = 5
smart_filter_join = on
@ -74,6 +75,7 @@ item_channel_modes = default
item_lag_counting = default
item_lag_finished = yellow
item_nick_modes = default
message_account = cyan
message_chghost = brown
message_join = green
message_kick = red
@ -156,3 +158,132 @@ usermode = ""
username = "daniel"
[server]
soupwhale.addresses = "irc.soupwhale.com"
soupwhale.proxy
soupwhale.ipv6
soupwhale.ssl
soupwhale.ssl_cert
soupwhale.ssl_password
soupwhale.ssl_priorities
soupwhale.ssl_dhkey_size
soupwhale.ssl_fingerprint
soupwhale.ssl_verify
soupwhale.password
soupwhale.capabilities
soupwhale.sasl_mechanism
soupwhale.sasl_username
soupwhale.sasl_password
soupwhale.sasl_key
soupwhale.sasl_timeout
soupwhale.sasl_fail
soupwhale.autoconnect
soupwhale.autoreconnect
soupwhale.autoreconnect_delay
soupwhale.nicks
soupwhale.nicks_alternate
soupwhale.username
soupwhale.realname
soupwhale.local_hostname
soupwhale.usermode
soupwhale.command
soupwhale.command_delay
soupwhale.autojoin
soupwhale.autorejoin
soupwhale.autorejoin_delay
soupwhale.connection_timeout
soupwhale.anti_flood_prio_high
soupwhale.anti_flood_prio_low
soupwhale.away_check
soupwhale.away_check_max_nicks
soupwhale.msg_kick
soupwhale.msg_part
soupwhale.msg_quit
soupwhale.notify
soupwhale.split_msg_max_length
soupwhale.charset_message
soup.addresses = "irc.soupwhale.com"
soup.proxy
soup.ipv6
soup.ssl
soup.ssl_cert
soup.ssl_password
soup.ssl_priorities
soup.ssl_dhkey_size
soup.ssl_fingerprint
soup.ssl_verify
soup.password
soup.capabilities
soup.sasl_mechanism
soup.sasl_username
soup.sasl_password
soup.sasl_key
soup.sasl_timeout
soup.sasl_fail
soup.autoconnect
soup.autoreconnect
soup.autoreconnect_delay
soup.nicks
soup.nicks_alternate
soup.username
soup.realname
soup.local_hostname
soup.usermode
soup.command
soup.command_delay
soup.autojoin
soup.autorejoin
soup.autorejoin_delay
soup.connection_timeout
soup.anti_flood_prio_high
soup.anti_flood_prio_low
soup.away_check
soup.away_check_max_nicks
soup.msg_kick
soup.msg_part
soup.msg_quit
soup.notify
soup.split_msg_max_length
soup.charset_message
freenode.addresses = "irc.freenode.net"
freenode.proxy
freenode.ipv6
freenode.ssl
freenode.ssl_cert
freenode.ssl_password
freenode.ssl_priorities
freenode.ssl_dhkey_size
freenode.ssl_fingerprint
freenode.ssl_verify
freenode.password
freenode.capabilities
freenode.sasl_mechanism
freenode.sasl_username
freenode.sasl_password
freenode.sasl_key
freenode.sasl_timeout
freenode.sasl_fail
freenode.autoconnect
freenode.autoreconnect
freenode.autoreconnect_delay
freenode.nicks
freenode.nicks_alternate
freenode.username
freenode.realname
freenode.local_hostname
freenode.usermode
freenode.command
freenode.command_delay
freenode.autojoin
freenode.autorejoin
freenode.autorejoin_delay
freenode.connection_timeout
freenode.anti_flood_prio_high
freenode.anti_flood_prio_low
freenode.away_check
freenode.away_check_max_nicks
freenode.msg_kick
freenode.msg_part
freenode.msg_quit
freenode.notify
freenode.split_msg_max_length
freenode.charset_message

View file

@ -27,12 +27,16 @@ text_selected = white
[network]
allow_empty_password = off
allowed_ips = ""
auth_timeout = 60
bind_address = ""
clients_purge_delay = 0
compression_level = 6
ipv6 = on
max_clients = 5
nonce_size = 16
password = ""
password_hash_algo = "*"
password_hash_iterations = 100000
ssl_cert_key = "%h/ssl/relay.pem"
ssl_priorities = "NORMAL:-VERS-SSL3.0"
totp_secret = ""

View file

@ -247,6 +247,7 @@ save_config_on_unload = on
[bar]
buflist.color_bg = default
buflist.color_bg_inactive = default
buflist.color_delim = default
buflist.color_fg = default
buflist.conditions = ""
@ -261,6 +262,7 @@ buflist.size = 0
buflist.size_max = 0
buflist.type = root
fset.color_bg = default
fset.color_bg_inactive = default
fset.color_delim = cyan
fset.color_fg = default
fset.conditions = "${buffer.full_name} == fset.fset"
@ -275,6 +277,7 @@ fset.size = 3
fset.size_max = 3
fset.type = window
input.color_bg = default
input.color_bg_inactive = default
input.color_delim = cyan
input.color_fg = default
input.conditions = ""
@ -289,6 +292,7 @@ input.size = 1
input.size_max = 0
input.type = window
nicklist.color_bg = default
nicklist.color_bg_inactive = default
nicklist.color_delim = cyan
nicklist.color_fg = default
nicklist.conditions = "${nicklist}"
@ -303,6 +307,7 @@ nicklist.size = 0
nicklist.size_max = 10
nicklist.type = window
status.color_bg = 0
status.color_bg_inactive = default
status.color_delim = cyan
status.color_fg = default
status.conditions = ""
@ -317,6 +322,7 @@ status.size = 1
status.size_max = 0
status.type = window
title.color_bg = 0
title.color_bg_inactive = default
title.color_delim = cyan
title.color_fg = default
title.conditions = ""
@ -397,6 +403,7 @@ meta-9 = "/buffer *9"
meta-< = "/input jump_previously_visited_buffer"
meta-= = "/filter toggle"
meta-> = "/input jump_next_visited_buffer"
meta-B = "/buflist toggle"
meta-OA = "/input history_global_previous"
meta-OB = "/input history_global_next"
meta-OC = "/input move_next_word"

View file

@ -1,124 +1,109 @@
#!/usr/bin/env bash
# NOTE: run this from inside a Linux installation, not from the live USB/CD
# TODO: detect if in a live image
head /etc/os-release --lines 1 | grep 'NixOS$' &>/dev/null; test $? -eq 1; is_nixos=$?
head /etc/os-release --lines 1 | grep 'Arch Linux' &>/dev/null; test $? -eq 1; is_arch_linux=$?
set -e
set -x
# NOTE: run this from inside a Linux installation, not from the live USB/CD
# TODO: detect OS and perform OS-specific setup
root_home="/root"
daniel_home="/home/daniel/.home"
nice_home="/home/daniel"
dotfiles="/.config/lytedev-dotfiles"
add_unstable_channel() {
nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable
nix-channel --update
run_via_dotfiles_if_necessary() {
# clone dotfiles and re-run from repo if we're not in the repo
pushd "$(dirname "$0")"
if git remote get-url origin | grep 'lytedev/dotfiles'; then
echo "Already in dotfiles repo!"
else
echo "Setting up dotfiles for $EUID..."
d="$HOME/.config/lytedev-dotfiles"
mkdir --parents "$d"
rm --recursive --force "$d"
git clone "https://git.lyte.dev/lytedev/dotfiles" "$d"
exec "$d/bin/init-dotfiles"
exit 0
fi
popd
}
clone_dotfiles() {
echo "Setting up dotfiles for $USER..."
mkdir --parents "$1"
rm --recursive --force "$1"
git clone "https://git.lyte.dev/lytedev/dotfiles" "$1"
}
symlink_nixos() {
symlink_nixos_config() {
rm --force "/etc/nixos/lytedev"
ln --symbolic "$1" "/etc/nixos/lytedev"
}
setup_wallpaper() {
mkdir --parents "$nice_home/img/walls"
curl --silent --output "$nice_home/img/walls/clouds_by_souredapply.png" \
"https://art.ngfiles.com/images/530000/530895_souredapple_clouds.png"
rm --recursive --force "$daniel_home/.wallpaper"
ln --symbolic "$nice_home/img/walls/clouds_by_souredapply.png" "$daniel_home/.wallpaper"
}
generate_ssh_key() {
mkdir --mode 600 --parents "$daniel_home/.ssh"
keyfile="$daniel_home/.ssh/$(hostname --short)"
if ! [ -f "$keyfile" ]; then
ssh-keygen -N '' -t ed25519 -f "$keyfile"
mkdir --mode 640 --parents "$nice_home/public"
cp "$keyfile.pub" "$nice_home/public"
fi
}
fix_dotfiles_origin() {
pushd "$daniel_home$dotfiles"
git remote set-url origin "ssh://git@git.lyte.dev:2222/lytedev/dotfiles.git"
popd
}
setup_home_manager() {
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install
}
setup_dotfiles() {
pushd "$daniel_home$dotfiles"
./bin/setup-dotfiles
popd
}
distro_specific_root_setup() {
if test $is_nixos -eq 1; then
symlink_nixos "$root_home$dotfiles/env/nix/"
add_unstable_channel
nixos-rebuild switch # this should create the `daniel` user
elif test $is_arch_linux -eq 1; then
"$root_home$dotfiles/env/arch-linux/provision.d/00-add-user.bash"
fi
}
distro_specific_user_setup() {
if test $is_nixos -eq 1; then
FUNC=$(declare -f symlink_nixos)
sudo sh -c "$FUNC; symlink_nixos \"$daniel_home$dotfiles/env/nix/\""
elif test $is_arch_linux -eq 1; then
"$root_home$dotfiles/env/arch-linux/provision.sh"
fi
}
init_for_root() {
clone_dotfiles "$root_home$dotfiles"
distro_specific_root_setup
clone_dotfiles "$daniel_home$dotfiles"
chown daniel:users -R "$daniel_home"
echo "Re-running as user daniel..."
sudo --user daniel "$daniel_home$dotfiles/bin/init-dotfiles"
}
init_for_daniel() {
set +x
clone_dotfiles "$daniel_home$dotfiles"
generate_ssh_key
distro_specific_user_setup
setup_wallpaper
# TODO: setup ssh/gpg keys
# TODO: setup password store
fix_dotfiles_origin
setup_dotfiles
# TODO: fetch password store
# TODO: fetch notes database
}
if [ "$EUID" -eq 0 ]; then
if test $is_arch_linux -eq 1; then
pacman -S --needed git inetutils
pacman -Sy --needed --noconfirm git inetutils openssh sudo
fi
init_for_root
run_via_dotfiles_if_necessary
pushd "$(dirname "$0")/.."
if test $is_nixos -eq 1; then
symlink_nixos_config "$HOME/.config/lytedev-dotfiles/env/nix/"
nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable
nix-channel --update
nixos-rebuild switch # this should create the `daniel` user
elif test $is_arch_linux -eq 1; then
ls -la
"env/arch-linux/provision.d/00-add-user.bash"
fi
c=/home/daniel/.home/.config/
mkdir --parents "$c"
chown -R daniel:users "$c"
cp --recursive . "$c/lytedev-dotfiles"
sudo --user daniel "$c/bin/init-dotfiles"
popd
exit 0
else
init_for_daniel
run_via_dotfiles_if_necessary
echo
echo
echo
echo "PREPARING TO GENERATE SSH KEY FOR USER"
echo
echo
echo
pushd "$HOME"
keyfile=".ssh/$(hostname --short)"
echo $keyfile
if ! [ -f "$keyfile" ]; then
mkdir --mode 700 --parents .ssh
chmod 700 .ssh
ls -la .ssh
ssh-keygen -N '' -t ed25519 -f "$keyfile"
mkdir --mode 755 --parents "$NICE_HOME/public"
cp "$keyfile.pub" "$NICE_HOME/public"
fi
popd
if test $is_nixos -eq 1; then
FUNC=$(declare -f symlink_nixos_config)
sudo sh -c "$FUNC; symlink_nixos_config \"$HOME/.config/lytedev-dotfiles/env/nix/\""
elif test $is_arch_linux -eq 1; then
sudo "$HOME/.config/lytedev-dotfiles/env/arch-linux/provision.sh"
fi
mkdir --parents "$NICE_HOME/img/walls"
curl --silent --output "$NICE_HOME/img/walls/clouds_by_souredapply.png" \
"https://art.ngfiles.com/images/530000/530895_souredapple_clouds.png"
rm --recursive --force "$HOME/.wallpaper"
ln --symbolic "$NICE_HOME/img/walls/clouds_by_souredapply.png" "$HOME/.wallpaper"
# TODO: setup ssh/gpg keys
# TODO: setup password store
pushd "$HOME/.config/lytedev-dotfiles"
git remote set-url origin "ssh://git@git.lyte.dev:2222/lytedev/dotfiles.git"
./bin/setup-dotfiles
popd
# nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
# nix-channel --update
# nix-shell '<home-manager>' -A install
# TODO: fetch password store
# TODO: fetch notes database
fi
echo "Here is this machine's public SSH key:"
echo " $(cat "$daniel_home/.ssh/$(hostname --short).pub")"
echo " $(cat "$HOME/.ssh/$(hostname --short).pub")"
echo "It needs to be added to existing cloud-based git accounts"
echo "and other machines before proceeding."
echo

View file

@ -19,20 +19,12 @@ done
links=(
# desktop environment files
"apps/de/bspwm/rc" "$XDG_CONFIG_HOME/bspwm/bspwmrc"
"apps/de/bspwm/wallpapers" "$HOME/.fehbg"
"apps/de/sway/config" "$XDG_CONFIG_HOME/sway/config"
"apps/de/sway/lock" "$XDG_CONFIG_HOME/swaylock/config"
"apps/de/sxhkd/rc" "$XDG_CONFIG_HOME/sxhkd/sxhkdrc"
"apps/de/x/resources" "$HOME/.Xresources"
"apps/de/x/init" "$HOME/.xinitrc"
"apps/de/x/init" "$HOME/.vnc/xstartup"
"apps/de/x/profile" "$HOME/.xprofile"
"apps/de/x/modmap" "$HOME/.xmodmap"
"apps/de/compton/compton.conf" "$XDG_CONFIG_HOME/compton.conf"
"apps/de/dunst/rc" "$XDG_CONFIG_HOME/dunst/dunstrc"
"apps/de/mako/" "$XDG_CONFIG_HOME/mako"
"env/common/colors/xresources" "$HOME/.Xresources.colors"
"apps/de/sway/mimeapps.list" "$XDG_CONFIG_HOME/mimeapps.list"
"apps/de/sway/mimeapps.list" "$XDG_CONFIG_HOME/sway-mimeapps.list"
"apps/de/sway/mimeapps.list" "$HOME/.local/share/applications/mimeapps.list"
# shell files
"apps/shell/bash/rc" "$HOME/.bashrc"

View file

@ -1,11 +1,10 @@
#!/usr/bin/env sh
echo "${USER_LOGS_PATH}"
sess="$1"; shift
d="$(date +%Y-%m-%d_%H-%M-%S)"
f="${USER_LOGS_PATH}/${d}.${sess}.tmux-buffer.log"
mkdir -p "$(dirname "$f")"
touch "$f"
chmod 600 "$f"
tmux capture-pane -pS -1000000000 > "$f"
echo "Saved output to $f"
echo "Saved pane output to $f"

32
bin/tmux-window-list Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
ANY_WINDOW_PREFIX="#[fg=default]"
ANY_WINDOW_SUFFIX="#[bg=default]#[fg=default] "
CUR_WINDOW_PREFIX="#[fg=colour4]"
CUR_WINDOW_SUFFIX="${ANY_WINDOW_SUFFIX}"
URG_WINDOW_PREFIX="#[fg=colour1]"
URG_WINDOW_SUFFIX="${ANY_WINDOW_SUFFIX}"
CUR_TMUX_WINDOW="$1"
if [ -z "$1" ]; then
CUR_TMUX_WINDOW="$(tmux display-message -p '#S')"
fi
export CUR_TMUX_WINDOW
TMUX_WINDOW_LIST="$(tmux list-windows | awk \
-v curSesh="${CUR_TMUX_WINDOW}" \
-v aspre="${ANY_WINDOW_PREFIX}" \
-v assuf="${ANY_WINDOW_SUFFIX}" \
-v cspre="${CUR_WINDOW_PREFIX}" \
-v cssuf="${CUR_WINDOW_SUFFIX}" \
-v uspre="${URG_WINDOW_PREFIX}" \
-v ussuf="${URG_WINDOW_SUFFIX}" \
'{s=substr($1,0,length($1)-1);
if(s==curSesh){
s=cspre" "s" "cssuf
}else{
s=aspre" "s" "assuf
}printf s}')"
# shellcheck disable=SC2001
echo "${TMUX_WINDOW_LIST//\s*$/}" | sed -e 's/\s*$//'

View file

@ -6,7 +6,7 @@ ud="/home/$u"
# user exists - we will assume setup has already run
if getent passwd "$u"; then exit 0; fi
pacman -S --needed sudo
echo '%admin ALL=(ALL) ALL' >> /etc/sudoers.d/admin-group-sudoers
groupadd admin 2>/dev/null
mkdir --parents "$ud/.home" "$ud/dl"
useradd --home-dir "$ud/.home" \

View file

@ -64,6 +64,7 @@ yay -Sy \
alsa-plugins `# Plugins for ALSA` \
pulseaudio pavucontrol pulsemixer `# Audio Backend and Controls` \
neovim `# Text Editors` \
sc-im `# Spreadsheets` \
unzip `# Simple Unzipping` \
tmux `# Terminal Multiplexer` \
kitty `# Almost Better Terminal Emulator` \
@ -73,6 +74,9 @@ yay -Sy \
kanshi-git `# Monitor Management for Sway` \
waybar-git mako-git `# Sway Bar & Notifications` \
slurp grim wl-clipboard `# Sway Screen Selection & Clipping` \
pipewire pipewire-pulse libpipewire02 `# Pipewire` \
xdg-desktop-portal xdg-desktop-portal-wlr `# Screensharing` \
obs-studio-wayland obs-xdg-portal `# OBS` \
ttf-iosevka `# Primary Fonts` \
ttf-font-awesome `# Icon Font` \
curl `# HTTP Utility` \