wow so cool

This commit is contained in:
Audrey 2025-02-19 22:27:00 -07:00
parent f31581e7d3
commit 6a9acfda3f
10 changed files with 407 additions and 39 deletions

View File

@ -2,35 +2,34 @@
{
networking.networkmanager.enable = true;
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable CUPS to print documents.
services.printing.enable = true;
services = {
xserver.enable = true;
# Enable sound.
services.pipewire = {
enable = true;
pulse.enable = true;
printing.enable = true;
pipewire = {
enable = true;
pulse.enable = true;
};
libinput.enable = true;
displayManager.sddm = {
enable = true;
wayland.enable = true;
};
desktopManager.plasma6 = {
enable = true;
};
};
# Enable touchpad support (enabled default in most desktopManager).
services.libinput.enable = true;
virtualisation.docker = {
enable = true;
storageDriver = "zfs";
logDriver = "journald";
};
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
};
services.desktopManager.plasma6 = {
enable = true;
};
programs = {
firefox.enable = true;
kdeconnect.enable = true;
@ -38,5 +37,9 @@
environment.systemPackages = with pkgs; [
dino
discord
element-desktop
slack
obs-studio
];
}

View File

@ -2,6 +2,7 @@
{
imports = [ ./overlays/packages.nix ];
nixpkgs.config.allowUnfree = true;
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
@ -35,14 +36,79 @@
wget
curl
btop
tmux
nixfmt-rfc-style
# language servers
nil
rust-analyzer
lua-language-server
clang-tools
bash-language-server
pyright
csharp-ls
gopls
typescript-language-server
#ocamllsp
(python3.withPackages (p: with p; [
virtualenvwrapper
pylint
pytest
ipdb
ipython
]))
pre-commit
];
programs = {
zsh.enable = true;
zsh = {
enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
vteIntegration = true;
enableLsColors = true;
histSize = 10000;
promptInit = ''
. ${pkgs.python3Packages.virtualenvwrapper}/bin/virtualenvwrapper.sh
'' + builtins.readFile ./dotfiles/zsh-prompt.sh;
shellInit = builtins.readFile ./dotfiles/zsh-init.sh;
shellAliases = {
nixos-edit = "(cd ~/nixos-config && vim configuration.nix)";
nixos-apply = "sudo nixos-rebuild switch --flake ~/nixos-config#$HOST";
ls = "ls --group-directories-first --color=auto";
ll = "ls -lh";
lh = "ll -ab";
l = "ls -ab";
grep = "grep --color=auto";
egrep = "egrep --color=auto";
objdump = "objdump -M intel";
gits = "git status";
pag = "ps aux | grep -v grep | grep -i";
hd = "hexdump -C";
man = "MAN_POSIXLY_CORRECT=1 man";
nose = "pytest -v --capture=no --pdbcls=IPython.terminal.debugger:TerminalPdb";
mkvirtualenv = "mkvirtualenv -r /etc/venv-default.txt";
};
};
tmux = {
enable = true;
extraConfig = builtins.readFile ./dotfiles/tmux.conf;
};
htop.enable = true;
git.enable = true;
git = {
enable = true;
lfs.enable = true;
config = {
user.email = "audrey@rhelmot.io";
user.name = "Audrey Dutcher";
core.editor = "nvim";
init.defaultBranch = "main";
blame.markUnblamableLines = true;
merge.tool = "meld";
credential.helper = "store";
url."ssh://git@".insteadOf = "git://";
};
};
neovim = {
enable = true;
defaultEditor = true;
@ -79,6 +145,15 @@
};
};
environment.etc."gdb/gdbinit".source = ./dotfiles/gdb-init.gdb;
environment.etc."venv-default.txt".source = ./dotfiles/venv-default.txt;
security.pam.u2f = {
enable = true;
settings.authfile = ./dotfiles/u2f-keys;
settings.cue = true;
};
# Enable the OpenSSH daemon.
services.openssh.enable = true;
}

23
dotfiles/gdb-init.gdb Normal file
View File

@ -0,0 +1,23 @@
set disassembly-flavor intel
#set follow-fork-mode child
#set detatch-on-fork off
set auto-load safe-path /
set history save on
set history filename ~/.gdb_history
#source ~/code/peda/peda.py
#source ~/code/gef/gef.py
set $base64 = 0x0000555555554000
define hd
dump binary memory /tmp/gdb-xxd $arg0 $arg0+$arg1
shell hexdump -C /tmp/gdb-xxd
end
#add-auto-load-safe-path /home/audrey/.rustup/toolchains
#dir /home/audrey/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/etc
#source ~/.decomp2dbg.py
# apt install python3-dbg
#source /usr/share/doc/python3.10/gdbinit
#source /home/audrey/.gdbinit-gef.py

View File

@ -273,8 +273,12 @@ rust_root_dir = function(fname)
return primary or fallback
end
local pipe = io.popen('rustup which rust-analyzer --toolchain nightly')
local pipe = io.popen('rustup which rust-analyzer --toolchain nightly 2>/dev/null')
local rust_analyzer = pipe:read()
if rust_analyzer == nil then
pipe = io.popen('which rust-analyzer')
rust_analyzer = pipe:read()
end
pipe = io.popen('which clangd')
clangd = pipe:read()
if clangd == nil then
@ -283,6 +287,8 @@ if clangd == nil then
end
pipe = io.popen('which bash-language-server')
bashls = pipe:read()
pipe = io.popen('which pyright')
pyright = pipe:read()
pipe.close()
if rust_analyzer ~= nil then
rt.setup({
@ -294,19 +300,22 @@ if rust_analyzer ~= nil then
},
})
end
lspconfig.pyright.setup{
on_attach = lsp_keybinds,
capabilities = capabilities,
settings = {
python = {
analysis = {
autoSearchPaths = false,
diagnosticMode = "openFilesOnly",
useLibraryCodeForTypes = false,
if pyright ~= nil then
lspconfig.pyright.setup{
on_attach = lsp_keybinds,
capabilities = capabilities,
cmd = {pyright},
settings = {
python = {
analysis = {
autoSearchPaths = false,
diagnosticMode = "openFilesOnly",
useLibraryCodeForTypes = false,
},
},
},
},
}
}
end
if clangd ~= nil then
lspconfig.clangd.setup{
on_attach = lsp_keybinds,
@ -353,10 +362,10 @@ lspconfig.lua_ls.setup{
},
},
}
lspconfig.ocamllsp.setup{
on_attach = lsp_keybinds,
capabilities = capabilities,
}
--lspconfig.ocamllsp.setup{
-- on_attach = lsp_keybinds,
-- capabilities = capabilities,
--}
--vim.api.nvim_create_autocmd({ "BufWritePost", "BufReadPost" }, {
-- callback = function()

60
dotfiles/tmux.conf Normal file
View File

@ -0,0 +1,60 @@
# some basic options
set-option -g default-shell $SHELL
set-window-option -g mode-keys vi
set-option -g history-limit 10000
set-option -g set-clipboard off
set -g escape-time 10
# set prefix to c-a
unbind C-a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
set -g status-bg red
set -g status-fg white
# do some cool color stuff
set -g default-terminal "tmux-256color"
set -sa terminal-overrides ",xterm*:Tc" # true-color
set -as terminal-overrides ',xterm*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',xterm*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
# smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L || true"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D || true"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U || true"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R || true"
# TODO bind these in vi normal mode
bind C-h send-keys C-h
bind C-j send-keys C-j
bind C-k send-keys C-k
bind C-l send-keys C-l
# sane copying (TODO?)
bind -Tcopy-mode-vi 'v' send -X begin-selection
bind -Tcopy-mode-vi 'Y' send -X copy-pipe 'xclip'
# launch splits in the same directory and with some copied environment
# new window command opens window after current window
unbind %
unbind '"'
unbind c
bind % split-window -c "#{pane_current_path}" -h
bind '"' split-window -c "#{pane_current_path}" -v
bind c new-window -c "#{pane_current_path}" -a
# garbage-collect split pane variables
#set-hook -g pane-exited 'run-shell "zsh -c \"HOOK_PANE=#{hook_pane}; for VAR in \\\$(tmux show-environment | grep \"^ZSH_PANE_\\\${HOOK_PANE#%}_\" | cut -d= -f1); do tmux set-environment -u \\\${VAR}; done\""'
# don't change the title once I've set it
set-option -g allow-rename off
# set window title to session name for scripting
set-option -g set-titles-string "#H tmux #{session_name}"
set-option -g set-titles on
# do stuff on focus
set focus-events on
set-hook -g client-focus-in[0] attach
#set-hook -g client-focus-in[1] 'run-shell "bash -c \"tmux list-panes -sF \\\"##D\\\" | while read -r MY_PANE; do tmux set-environment ZSH_PANE_\\\${MY_PANE#%}_IMPORTS \\\"\\\$(for var in DISPLAY WAYLAND_DISPLAY; do tmux show-environment -s \\\$var || true ; done)\\\"; done\" >/tmp/augh 2>&1"'

1
dotfiles/u2f-keys Normal file
View File

@ -0,0 +1 @@
audrey:6pHU4pjv0ynp+Z3SkNyHTDhkMey2fzoLsZpU19jsvKjLyi++NZgxSBY1G9iJ1EPZAoLC9YHWyP8u9nKTkCemgg==,juL2EyhGRO9D5wIOg60jua83A4GUbQqfl2GrWnliJbj/0RPp5vUgMe1nZO6BdqfC6mx5IFfDlD5s41B/A3NqNQ==,es256,+presence

View File

@ -0,0 +1,8 @@
pylint
neovim
nose
pytest
ipdb
ipython
virtualenvwrapper
pre_commit

139
dotfiles/zsh-init.sh Normal file
View File

@ -0,0 +1,139 @@
# vim: ft=zsh
setopt appendhistory notify
unsetopt beep nomatch
#
# key binding configuration
#
# create a zkbd compatible hash
# to add other keys to this hash, see: man 5 terminfo
typeset -A key
key[Home]=${terminfo[khome]}
key[End]=${terminfo[kend]}
key[Insert]=${terminfo[kich1]}
key[Delete]=${terminfo[kdch1]}
key[Up]=${terminfo[kcuu1]}
key[Down]=${terminfo[kcud1]}
key[Left]=${terminfo[kcub1]}
key[Right]=${terminfo[kcuf1]}
key[PageUp]=${terminfo[kpp]}
key[PageDown]=${terminfo[knp]}
key[Backspace]=${terminfo[kbs]}
# setup keybindings!
bindkey -v
export KEYTIMEOUT=1
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" backward-delete-char
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
[[ -n "${key[Backspace]}" ]] && bindkey "${key[Backspace]}" backward-delete-char
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" up-history
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" down-history
bindkey '^P' up-history
bindkey '^N' down-history
bindkey '^h' backward-delete-char
bindkey '^w' backward-kill-word
bindkey '^r' history-incremental-search-backward
bindkey -a '/' history-incremental-search-backward
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
function enter-editing-mode () {
printf '%s' "${terminfo[smkx]}"
}
function exit-editing-mode () {
printf '%s' "${terminfo[rmkx]}"
}
zle -N zle-line-init enter-editing-mode
zle -N zle-line-finish exit-editing-mode
fi
#
# Aliases
#
# standard functions
# https://stackoverflow.com/questions/6250698/how-to-decode-url-encoded-string-in-shell
function urldecode() {
python3 -c "import sys; from urllib.parse import unquote; print(unquote(sys.stdin.read()));"
}
function highlight() {
THING="$1"
shift
egrep --color=always "$THING|\$" "$@"
}
function rmida () {
rm -f *.idb *.i64 *.id0 *.id1 *.id2 *.id3 *.nam *.til
}
function rustc() { $(/bin/which rustc) "$@" && echo "Good girl." }
function scale () {
INP=$1
OUT=$2
SCALE=${3-2}
SIZE="$(file $INP | egrep -o '[[:digit:]]+ x [[:digit:]]+')"
X=$(cut -d' ' -f1 <<<$SIZE)
Y=$(cut -d' ' -f3 <<<$SIZE)
convert $INP -size $(($X / $SCALE))x$(($Y / $SCALE)) $OUT
}
# watch a file and display a diff between an old and new version with respect to some command
function watchdiff() {
WATCHME="$1"
NEWFILE=$(mktemp)
OLDFILE=$(mktemp)
shift
trap "rm -f $NEWFILE $OLDFILE; return" INT
while true; do
inotifywait -q -e close_write "$WATCHME"
"$@" >$NEWFILE
date
diff -u $OLDFILE $NEWFILE | perl /usr/share/doc/git/contrib/diff-highlight/diff-highlight | colordiff
mv $NEWFILE $OLDFILE
done
}
# virtualenv integration
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=$(which python3)
function tmpvirtualenv() {
rmvirtualenv test &>/dev/null
mkvirtualenv "$@" test && workon test
}
# default virtualenv
if [ -d ~/.virtualenvs/default ]; then
. ~/.virtualenvs/default/bin/activate
fi
# standard vars
export PYTHONBREAKPOINT="ipdb.set_trace"
#export UV_USE_IO_URING=0 # TODO remove - quitting nvim on python files hangs
export COLORTERM=1
export SHELL=$(which zsh)
export npm_config_prefix=~/.local
# site vars, functions, and aliases
if [ -e ~/.site_aliases.sh ]; then
source ~/.site_aliases.sh
fi

48
dotfiles/zsh-prompt.sh Normal file
View File

@ -0,0 +1,48 @@
# vim: ft=zsh
NOCOLOR=""
PURPLE=""
YELLOW=""
GREEN=""
BOLDYELLOW=""
BOLDRED=""
BOLDGREEN=""
typeset -A modecolor
modecolor[emacs]=$BOLDYELLOW
modecolor[viins]=$BOLDYELLOW
modecolor[main]=$BOLDYELLOW
modecolor[vicmd]=$PURPLE
modecolor[viopp]=$BOLDYELLOW
modecolor[visual]=$YELLOW
modecolor[isearch]=$BOLDRED
modecolor[command]=$BOLDGREEN
modecolor[.safe]=$BOLDYELLOW
function update-prompt-color {
MODE=$2
[ -z "$MODE" ] && MODE=$KEYMAP
[ -z "$MODE" ] && MODE=main
COLOR="${modecolor[$MODE]}"
[ "$MODE" = "main" ] && INDICATOR='+' || INDICATOR=' '
PS1="%{$COLOR%}[$INDICATOR] %~%# %{$NOCOLOR%}"
[ -n "$VIRTUAL_ENV" -a ! "$(basename "$VIRTUAL_ENV")" = "default" ] && VENV_STRING="%{$GREEN%}($(basename $VIRTUAL_ENV))" || VENV_STRING=
USER_STRING="%{$PURPLE%}%n@%m"
#USER_STRING="%{$PURPLE%}rhelmot@%m"
TIME_STRING="%{$PURPLE%}[%{$YELLOW%}%D{%r}%{$PURPLE%}]"
RPS1="$VENV_STRING $USER_STRING $TIME_STRING%{$NOCOLOR%}"
zle && zle reset-prompt
}
function neutral-prompt-color {
update-prompt-color dummy main
}
zle -N zle-line-init update-prompt-color
zle -N zle-keymap-select update-prompt-color
zle -N zle-line-finish neutral-prompt-color
update-prompt-color

View File

@ -9,6 +9,8 @@
services.zfs.trim.enable = true;
# fstrim is also enabled by nixos-hardware, but only runs for /boot
services.fprintd.enable = true;
networking.hostName = "daisy";
networking.hostId = "293a1290";