nixos-config/home/rachel.nix
2024-05-19 11:04:06 +02:00

517 lines
15 KiB
Nix

{ pkgs, unstable, cornelis, cornelis-vim, agda, slippi-netplay, ... }:
let username = "rachel";
homeDir = "/home/${username}";
SAX2NF = import ../shared/sax2nf.nix { inherit pkgs; };
hpkgs = pkgs.haskellPackages;
hls_wrapper = pkgs.writeScript "hls" ''
export PATH="${hpkgs.haskell-language-server}/bin:$PATH"
exec ${hpkgs.haskell-language-server}/bin/haskell-language-server-wrapper "$@"
'';
rzk = hpkgs.rzk;
in
{
home = {
username = username;
homeDirectory = homeDir;
packages = with pkgs; [
unzip
zip
xz
gzip
bzip2
p7zip
usbutils
pciutils
nettools
nmap
arp-scan
julia-bin
(python3.withPackages (ps: with ps; [
ipython
matplotlib
numpy
scipy
]))
hpkgs.ghc
firefox
gnupg
agda
discord
dig
xxd
unstable.zoom-us
slack
imagemagick
ffmpeg
sl
cowsay
lolcat
fortune
banner
yt-dlp
libreoffice
protonmail-bridge
pass
protonvpn-cli_2
thunderbird
tidal-hifi
signal-desktop
transmission-gtk
xclip
clinfo
glxinfo
vulkan-tools
obs-studio
file
gimp
SAX2NF
twemoji-color-font
bat
steam
steam-run
rmapi
lutris
texlive.combined.scheme-full
cornelis
zulip
rink
sage
typst
ttyper
idris2
prismlauncher
vimv
rzk
whalebird
lean4
slippi-netplay
unstable.kicad
remmina
unstable.renoise
];
stateVersion = "23.11";
};
xdg.userDirs = {
enable = true;
createDirectories = true;
desktop = "${homeDir}";
documents = "${homeDir}/doc";
download = "${homeDir}/dwn";
music = "${homeDir}/music";
pictures = "${homeDir}/img";
publicShare = "${homeDir}/srv";
templates = "${homeDir}/doc/templates";
videos = "${homeDir}/vid";
};
programs = {
bash = {
enable = true;
enableCompletion = false;
historyFile = "/dev/null";
sessionVariables = {
PS1 ="\\033[1m\\u\\033[0m@\\033[1m\\h\\033[0m: \\w\nλ ";
BROWSER = "firefox";
XINITRC = "${homeDir}/bin/xinitrc";
XAUTHORITY = "${homeDir}/.local/share/Xauthority";
PASH_KEYID = "3E4A909C8FEF6E3783699C79DFC26EF8EDAD6D71";
QT_AUTO_SCREEN_FACTOR = 1;
PATH = "${homeDir}/bin:$PATH";
};
shellAliases = {
x = "startx";
rm = "rm -i";
cal = "cal -m";
};
initExtra = ''
source ~/.profile
set -o vi
'';
};
mpv = {
enable = true;
config = {
hwdec = "auto-safe";
vo = "gpu";
profile = "gpu-hq";
};
};
rofi = {
enable = true;
theme = "gruvbox-dark-soft";
};
git = {
enable = true;
userName = "Rachel Lambda Samuelsson";
userEmail = "depsterr@protonmail.com";
extraConfig = {
init.defaultBranch = "master";
};
};
neovim = {
defaultEditor = true;
enable = true;
vimAlias = true;
extraLuaConfig = ''
require('tmux').setup({ copy_sync = { redirect_to_clipboard = true } });
require('Comment').setup()
require('nvim-surround').setup()
require('numb').setup()
local lspcfg = require('lspconfig')
lspcfg.typst_lsp.setup({
cmd = { '${pkgs.typst-lsp}/bin/typst-lsp' },
})
lspcfg.rust_analyzer.setup({})
lspcfg.hls.setup({
cmd = { '${hls_wrapper}', 'lsp' },
})
lspcfg.pyright.setup({
cmd = { '${pkgs.nodePackages.pyright}/bin/pyright-langserver', '--stdio' },
})
lspcfg.nixd.setup({
cmd = { '${pkgs.nixd}/bin/nixd' },
})
lspcfg.ltex.setup({
cmd = { '${pkgs.ltex-ls}/bin/ltex-ls' },
filetypes = { 'bib', 'gitcommit', 'markdown', 'plaintext', 'tex', 'pandoc', 'typst' },
settings = {
ltex = {
language = 'en-US'
}
}
})
lspcfg.clangd.setup({
cmd = { '${pkgs.clang-tools}/bin/clangd' },
})
lspcfg.ocamllsp.setup({})
require('orgmode').setup_ts_grammar()
require('nvim-treesitter.configs').setup({
highlight = {
enable = true,
disable = { "c", "lua" },
additional_vim_regex_highlighting = {'org'},
},
})
require('orgmode').setup({})
require('lean').setup({
mappings = true,
})
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'gruvbox',
component_separators = { left = "", right = ""},
section_separators = { left = "", right = ""},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = { {
'diagnostics',
always_visible = true,
on_click = function(n,b,m)
vim.diagnostic.goto_next()
end
} },
lualine_c = {'filename'},
lualine_x = {'encoding', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
}
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local opts = { buffer = args.buf }
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', '<localleader>r', vim.lsp.buf.rename, opts)
vim.keymap.set('n', '<localleader>a', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', '<localleader>gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', '<localleader>gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<localleader>gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<localleader>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '<localleader>n', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<localleader>N', vim.diagnostic.goto_prev, opts)
vim.keymap.set('i', '<C-n>', vim.lsp.omnifunc, opts)
end,
})
vim.api.nvim_create_autocmd({ "BufNew"
, "TextChanged"
, "TextChangedI"
, "TextChangedP"
, "TextChangedT"
}, {
callback = function(args)
vim.diagnostic.disable(args.buf)
end
})
vim.api.nvim_create_autocmd({"BufWrite"}, {
callback = function(args)
vim.diagnostic.enable(args.buf)
end
})
vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, {
pattern = { "*.rzk" },
callback = function(arg)
vim.lsp.start({
name = 'rzk-lsp',
cmd = { "${rzk}/bin/rzk", "lsp" },
root_dir = vim.fs.dirname(vim.fs.find('rzk.yaml', { upward = true })[1]),
})
end
})
'';
extraConfig = ''
set rnu nu
set ts=2 sw=2 expandtab
set clipboard=unnamedplus
set laststatus=3 noshowmode
set signcolumn=no
set linebreak
let g:cornelis_use_global_binary = 1
set conceallevel=2 concealcursor=nc
colorscheme gruvbox
hi Normal guibg=NONE ctermbg=NONE
let maplocalleader="!"
let g:bqn_prefix_key="!"
runtime agda-input.vim
call cornelis#bind_input(" ", "!")
call cornelis#bind_input("exc", "!")
inoremap <C-Space> <Esc>
nnoremap j gj
nnoremap k gk
nnoremap gj j
nnoremap gk k
au BufRead,BufNewFile *.agda call AgdaFiletype()
au BufRead,BufNewFile *.lagda.* call AgdaFiletype()
function! AgdaFiletype()
nnoremap <buffer> <C-c><C-l> :CornelisLoad<CR>
nnoremap <buffer> <C-c><C-r> :CornelisRefine<CR>
nnoremap <buffer> <C-c><C-c> :CornelisMakeCase<CR>
nnoremap <buffer> <C-c>, :CornelisTypeContext<CR>
nnoremap <buffer> <C-c>. :CornelisTypeContextInfer<CR>
nnoremap <buffer> <C-c><C-d> :CornelisTypeInfer<CR>
nnoremap <buffer> <C-c><C-s> :CornelisSolve<CR>
nnoremap <buffer> <C-c><C-a> :CornelisAuto<CR>
nnoremap <buffer> gd :CornelisGoToDefinition<CR>
nnoremap <buffer> <C-c><C-b> :CornelisPrevGoal<CR>
nnoremap <buffer> <C-c><C-f> :CornelisNextGoal<CR>
nnoremap <buffer> <C-c><C-u> :CornelisIgnoreAbstract<CR>
nnoremap <buffer> <C-c><space> :CornelisGive<CR>
endfunction
'';
plugins = let
bqn-vim = pkgs.vimUtils.buildVimPlugin {
name = "bqn-vim";
src = "${pkgs.fetchFromGitHub {
owner = "mlochbaum";
repo = "BQN";
rev = "f4b09b675386c789c8296c96874871916a3abdcf";
hash = "sha256-rvsageS5sYF9QvWuoRutjx5i0ngrfhGvIPRO834pwwM=";
}}/editors/vim";
};
bqn-nvim = pkgs.vimUtils.buildVimPlugin {
name = "bqn-nvim";
src = pkgs.fetchFromSourcehut {
owner = "~detegr";
repo = "nvim-bqn";
rev = "52d8b49f3ebc32d340e2e2b8dba1f6bbd1873b78";
hash = "sha256-5wITedTuUn9BKLqmQtPWeFNOa8dXfPIRpUvPSkNJcas=";
};
};
in
with pkgs.vimPlugins; [
nvim-surround
comment-nvim
vimtex
gruvbox-nvim
tmux-nvim
cornelis-vim
nvim-lspconfig
idris2-vim
numb-nvim
typst-vim
orgmode
(nvim-treesitter.withPlugins (p: with p; [
org
]))
vim-obsession
lean-nvim
bqn-vim
bqn-nvim
lualine-nvim
];
};
tmux = {
enable = true;
clock24 = true;
escapeTime = 0;
keyMode = "vi";
mouse = false;
shortcut = "a";
extraConfig = ''
bind h split -hb -c '#{pane_current_path}'
bind j split -v -c '#{pane_current_path}'
bind k split -vb -c '#{pane_current_path}'
bind l split -h -c '#{pane_current_path}'
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' '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'
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1'
bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1'
bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1'
bind -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'resize-pane -R 1'
bind-key -T copy-mode-vi M-h resize-pane -L 1
bind-key -T copy-mode-vi M-j resize-pane -D 1
bind-key -T copy-mode-vi M-k resize-pane -U 1
bind-key -T copy-mode-vi M-l resize-pane -R 1
set -g pane-border-style bg=default
set -g pane-border-style fg="#1D1F21"
set -g pane-active-border-style bg=default
set -g pane-active-border-style fg="#333333"
set-option -g status on
set-option -g status-style bg=default
set-option -g status-style fg="#ef7627"
set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-right " λ "
set -g status-interval 1
set-window-option -g window-status-separator "-"
set-window-option -g window-status-current-format " #[fg=#b55690 bold]!![ #{b:pane_current_path}/ ] #{b:window_index} $ #{b:pane_current_command}!! "
set-window-option -g window-status-format " #{b:window_index} [ #{b:pane_current_path}/ ] #{b:pane_current_command} "
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
'';
plugins = with pkgs.tmuxPlugins; [
resurrect
];
};
hyfetch = {
enable = true;
settings = {
preset = "lesbian";
mode = "rgb";
color_align = {
mode = "horizontal";
};
};
};
direnv = {
enable = true;
nix-direnv.enable = true;
};
alacritty = {
enable = true;
settings = {
window = {
padding.x = 5;
padding.y = 5;
decoration = "none";
};
dynamic_title = false;
mouse_hide_when_typing = true;
draw_bold_text_with_bright_colors = false;
scrolling.history = 0;
font = {
normal.family = "SAX2 Nerd Font";
size = 11;
};
colors = {
background = "#1d1f21";
foreground = "#c5c8c6";
};
shell.program =
let tmux-menu = pkgs.writeScript "tmux-menu" ''
s="$(tmux ls 2>/dev/null)"
[ "$s" ] && s="$s
"
c=$(${pkgs.fzf}/bin/fzf -1 <<-EOF
''${s}New Session
Raw Shell
EOF
) || exit
case "$c" in
"New Session")
read -p "Name? " -r n
${pkgs.tmux}/bin/tmux new -s "$n" ;;
"Raw Shell")
${pkgs.bash}/bin/bash --login ;;
*)
${pkgs.tmux}/bin/tmux attach-session -t "''${c%%:*}" ;;
esac
''; in "${tmux-menu}";
};
};
ssh = {
enable = true;
matchBlocks = {
remarkable = {
hostname = "10.11.99.1";
user = "root";
};
lazarus = {
hostname = "rachel.cafe";
user = "deppy";
};
zelda = {
hostname = "zelda.cse.chalmers.se";
user = "dhack";
};
};
};
};
services = {
gpg-agent = {
enable = true;
pinentryFlavor = "qt";
};
};
}