Move nvim config

This commit is contained in:
Martin Pander
2026-02-11 08:03:13 +01:00
parent 9b0b1f76f9
commit 38083b9af4
31 changed files with 105 additions and 27 deletions

59
modules/home/common.nix Normal file
View File

@@ -0,0 +1,59 @@
{ config, pkgs, lib, ... }:
{
options.dot = {
dotfilesPath = lib.mkOption {
type = lib.types.str;
default = "${config.home.homeDirectory}/dev/dot";
description = "Absolute path to the dotfiles repository on the local machine.";
};
};
imports = [
./secrets.nix
./sh.nix
./tmux.nix
./git.nix
./dev.nix
./nvim.nix
./task.nix
];
config = {
home.packages = with pkgs; [
nerd-fonts.fira-code
nil # Nix LSP
# Language servers
yaml-language-server
marksman
pkgs.unstable.dockerfile-language-server # Use unstable for latest LSP features
# Secrets management
sops
age
];
programs.ssh = {
enable = true;
enableDefaultConfig = false;
includes = [ "config.local" ];
matchBlocks = {
"*" = {
addKeysToAgent = "yes";
};
"git.pander.me" = {
hostname = "git.pander.me";
user = "git";
identityFile = "~/.ssh/private_git";
port = 2222;
};
};
};
news.display = "silent";
programs.home-manager.enable = true;
};
}

52
modules/home/dev.nix Normal file
View File

@@ -0,0 +1,52 @@
{ config, pkgs, lib, ... }:
let
cfg = config.dot.llm;
in
{
options.dot.llm = {
enable = lib.mkEnableOption "LLM tools";
claude-code.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable claude-code";
};
opencode.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable opencode";
};
gemini-cli.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable gemini-cli";
};
bubblewrap.enable = lib.mkOption {
type = lib.types.bool;
default = pkgs.stdenv.isLinux;
description = "Enable bubblewrap (Linux only)";
};
};
config = lib.mkMerge [
{
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
home.packages = with pkgs; [
visidata
];
}
(lib.mkIf cfg.enable {
home.packages =
(lib.optional cfg.claude-code.enable pkgs.unstable.claude-code) ++
(lib.optional cfg.opencode.enable pkgs.unstable.opencode) ++
(lib.optional cfg.gemini-cli.enable pkgs.unstable.gemini-cli) ++
(lib.optional (cfg.bubblewrap.enable && pkgs.stdenv.isLinux) pkgs.unstable.bubblewrap);
})
];
}

89
modules/home/git.nix Normal file
View File

@@ -0,0 +1,89 @@
{ config, pkgs, lib, ... }:
{
programs.git = {
enable = true;
settings = {
alias = {
st = "status";
ci = "commit";
co = "checkout";
br = "branch";
pl = "pull";
ps = "push";
sw = "switch";
mno =" merge --no-ff";
lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit";
cleanup = "!git fetch --prune && git branch -vv | grep ': gone]' | awk '{print $1}' | xargs git branch -D";
};
column.ui = "auto";
branch.sort = "-committerdate";
tag.sort = "version:refname";
diff = {
algorithm = "histogram";
colorMoved = "plain";
mnemonicPrefix = "true";
renames = "true";
};
pull.rebase = "true";
push = {
default = "simple";
autoSetupRemote = "true";
followTags = "true";
};
fetch = {
prune = "true";
pruneTags = "true";
all = "true";
};
help.autocorrect = "prompt";
commit.verbose = "true";
rerere = {
enabled = "true";
autoupdate = "true";
};
rebase = {
autoSquas = "true";
autoStash = "true";
updateRefs = "true";
};
merge.conflictstyle = "zdiff3";
core.editor = "nvim";
init.defaultBranch = "main";
};
ignores = [
".direnv/"
".envrc"
];
};
# Difftastic - modern diff tool
programs.difftastic = {
enable = true;
git.enable = true;
};
programs.lazygit = {
enable = true;
settings = {
theme.lightTheme = "true";
git = {
log = {
format = "%C(yellow)%h%Creset %C(bold blue)<%an>%Creset %s %Cgreen(%cr)%Creset";
graph = "true";
};
};
};
};
programs.jujutsu = {
enable = true;
settings = {
aliases = {
tug = ["bookmark" "move" "--from" "heads(::@- & bookmarks())" "--to" "@-"];
};
};
};
}

100
modules/home/nvim.nix Normal file
View File

@@ -0,0 +1,100 @@
{ config, pkgs, lib, ... }:
let
cfg = config.dot.nvim;
in
{
options.dot.nvim = {
workMode = lib.mkEnableOption "work-specific neovim configuration";
};
config = {
programs.neovim = {
enable = true;
defaultEditor = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
vim-repeat
vim-surround
ts-comments-nvim
vim-fugitive
gitsigns-nvim
nvim-tree-lua
targets-vim
mini-pairs
mini-align
mini-bracketed
mini-splitjoin
mini-move
mini-ai
mini-icons
flash-nvim
trouble-nvim
conform-nvim
nvim-lint
promise-async
nvim-ufo
vim-windowswap
plenary-nvim
telescope-nvim
telescope-fzf-native-nvim
telescope-ui-select-nvim
yanky-nvim
lualine-nvim
undotree
luasnip
nvim-cmp
cmp_luasnip
cmp-buffer
cmp-path
cmp-cmdline
cmp-nvim-lsp
cmp-nvim-lsp-signature-help
cmp_yanky
cmp-git
nvim-lspconfig
lspkind-nvim
copilot-lua
copilot-cmp
CopilotChat-nvim
bullets-vim
nvim-dap
nvim-nio
nvim-dap-ui
nvim-dap-virtual-text
nvim-dap-go
nvim-dap-python
nvim-dap-lldb
todo-comments-nvim
vim-markdown
zen-mode-nvim
plantuml-syntax
obsidian-nvim
render-markdown-nvim
image-nvim
img-clip-nvim
vim-nix
(nvim-treesitter.withPlugins (p: [ p.awk p.bash p.c p.c_sharp p.cpp p.css p.diff p.dockerfile p.doxygen p.git_config p.gitcommit p.go p.gomod p.gosum p.gotmpl p.helm p.haskell p.html p.http p.java p.javascript p.json p.latex p.lua p.markdown p.markdown_inline p.matlab p.nix p.printf p.python p.regex p.rust p.sql p.strace p.supercollider p.svelte p.swift p.terraform p.tmux p.toml p.typescript p.vim p.xml p.yaml p.zig ]))
];
extraLuaConfig = ''
_G.is_work = ${if cfg.workMode then "true" else "false"}
_G.is_home = ${if pkgs.stdenv.isDarwin then "true" else "false"}
require('base')
require('keymaps')
require('plugins')
require('filetype')
'';
};
# Allow for editing the lua modules without a nix rebuild
xdg.configFile."nvim/lua".source = config.lib.file.mkOutOfStoreSymlink "${config.dot.dotfilesPath}/modules/nvim/lua";
home.packages = with pkgs; [
nodejs-slim
];
};
}

20
modules/home/secrets.nix Normal file
View File

@@ -0,0 +1,20 @@
{ inputs, config, ... }:
{
imports = [
inputs.sops-nix.homeManagerModules.sops
];
sops = {
defaultSopsFile = ../../secrets/secrets.yaml;
defaultSopsFormat = "yaml";
age = {
keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt";
};
};
home.sessionVariables = {
SOPS_AGE_KEY_FILE = config.sops.age.keyFile;
};
}

109
modules/home/sh.nix Normal file
View File

@@ -0,0 +1,109 @@
{ config, pkgs, lib, ... }:
let
cfg = config.dot.sh;
in
{
options.dot.sh = {
sourceProfile = lib.mkEnableOption "sourcing of $HOME/.profile in zsh profileExtra";
};
config = {
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
history.size = 500000;
prezto = {
enable = true;
caseSensitive = true;
color = true;
editor = {
dotExpansion = true;
keymap = "vi";
};
pmodules = [
"environment"
"terminal"
"editor"
"history"
"directory"
"spectrum"
"utility"
"completion"
"ssh"
"syntax-highlighting"
"history-substring-search"
"prompt"
"git"
];
prompt.theme = "minimal";
syntaxHighlighting.highlighters = [
"main"
"brackets"
"pattern"
"line"
"cursor"
"root"
];
tmux = {
autoStartLocal = true;
itermIntegration = true;
};
};
initContent = ''
HISTCONTROL='erasedups:ignoreboth'
HISTIGNORE='&:[ ]*:exit:ls:bg:fg:history:clear'
unsetopt beep
'';
profileExtra = lib.mkIf cfg.sourceProfile ''
source $HOME/.profile
'';
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
programs.lsd = {
enable = true;
enableZshIntegration = true;
};
programs.zoxide = {
enable = true;
enableZshIntegration = true;
options = [
"--cmd cd"
];
};
programs.bat.enable = true;
programs.ripgrep.enable = true;
programs.btop.enable = true;
programs.ranger.enable = true;
home.packages = with pkgs; [
fd
dust
glow
ripgrep-all
viddy
duf
];
home.sessionVariables = {
BAT_THEME = "Coldark-Cold";
};
home.shellAliases = {
lst = "lsd --tree";
};
};
}

76
modules/home/task.nix Normal file
View File

@@ -0,0 +1,76 @@
{config, pkgs, lib, inputs, ...}:
{
programs.taskwarrior = {
enable = true;
colorTheme = "light-256";
package = pkgs.taskwarrior3;
config = {
weekstart = "monday";
uda.tasksquire.tags.default="code,comm,cust,del,doc,mngmnt,ops,rsrch,rvw,track";
uda.parenttask.type="string";
uda.parenttask.label="Parent";
uda.energy.type="string";
uda.energy.label="Energy";
uda.energy.values="h,m,l";
uda.energy.default="m";
uda.priority.values = "H,M,,L";
urgency.uda.priority.L.coefficient = -0.5;
urgency.user.tag.deferred.coefficient = -15.0;
urgency.user.tag.cust.coefficient = 5.0;
urgency.user.tag.fixed.coefficient = -100.0;
report.next.columns="id,start.age,entry.age,depends,priority,energy,project,tags,recur,scheduled.countdown,due.relative,until.remaining,description,urgency";
report.next.labels="ID,Active,Age,Deps,P,E,Project,Tag,Recur,S,Due,Until,Description,Urg";
report.next.filter="status:pending -WAITING -deferred -track";
report.time.columns="id,start.age,entry.age,depends,priority,energy,project,tags,recur,scheduled.countdown,due.relative,until.remaining,description,urgency";
report.time.labels="ID,Active,Age,Deps,P,E,Project,Tag,Recur,S,Due,Until,Description,Urg";
report.time.filter="status:pending -WAITING -deferred +fixed";
report.deferred.columns="id,start.age,entry.age,depends,priority,energy,project,tags,recur,scheduled.countdown,due.relative,until.remaining,description,urgency";
report.deferred.context="1";
report.deferred.description="Deferred and waiting tasks";
report.deferred.labels="ID,Active,Age,Deps,P,E,Project,Tag,Recur,S,Due,Until,Description,Urg";
report.deferred.filter="status:pending +deferred";
report.deferred.sort="urgency-";
report.low.columns="id,start.age,entry.age,depends,priority,energy,project,tags,recur,scheduled.countdown,due.relative,until.remaining,description,urgency";
report.low.context="1";
report.low.description="Low energy tasks";
report.low.filter="status:pending -WAITING -deferred";
report.low.labels="ID,Active,Age,Deps,P,E,Project,Tag,Recur,S,Due,Until,Description,Urg";
report.low.sort="energy+,urgency-";
context.today.read = "(prio:H or +next)";
context.today.write = "prio:H +next";
context.deferred.read = "+deferred";
context.deferred.write = "+deferred";
context.customer.read = "+cust";
context.customer.write = "+cust";
context.low_energy.read = "+low";
context.low_energy.write = "+low";
uda.taskwarrior-tui.task-report.show-info = false;
uda.taskwarrior-tui.selection.reverse = "yes";
};
};
home.packages = with pkgs; [
taskwarrior-tui
unstable.timewarrior
inputs.tasksquire.packages.${pkgs.system}.default
];
home.shellAliases = lib.mkMerge [ {
t = "task";
tt = "taskwarrior-tui";
tw = "timew";
tws = "timew summary :ids";
}
];
}

83
modules/home/tmux.nix Normal file
View File

@@ -0,0 +1,83 @@
{ config, pkgs, lib, ... }:
let
cfg = config.dot.tmux;
in
{
options.dot.tmux = {
workMode = lib.mkEnableOption "work-specific tmux configuration";
};
config = {
programs.tmux = {
enable = true;
shortcut = "a";
mouse = true;
keyMode = "vi";
escapeTime = 0;
terminal = "screen-256color";
tmuxp.enable = true;
extraConfig = ''
set -g display-time 1500
unbind S
bind S command-prompt "switch -t %1"
bind-key -n M-K switch-client -p
bind-key -n M-J switch-client -n
bind-key -n M-L next-window
bind-key -n M-H previous-window
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -a -c "#{pane_current_path}"
bind C-g display-popup -E -d "#{pane_current_path}" -xC -yC -w 95% -h 95% "lazygit"
bind C-t display-popup -E -xC -yC -w 95% -h 95% "tasksquire"
${lib.optionalString cfg.workMode ''
bind C-s display-popup -E "zsh ~/bin/tmuxp_selector.sh"
bind C-n display-popup -E -xC -yC -w 95% -h 95% -d "~/Documents/notes/Work/" "vim quick_notes.md"
bind C-p display-popup -E -xC -yC -w 95% -h 95% -d "~/Documents/notes/Work/development/" "vim mbpr.md"
''}
#######################################
# status line
#######################################
set -g status-justify centre
set -g status-left "#[bg=#808080,fg=#ffffff,bold] #S #[default]#[bg=#BCBCBC] #{-30:pane_title} "
set -g status-left-length 40
set -g status-right "#[bg=#BCBCBC] %H:%M #[bg=#808080,fg=#ffffff] %d.%m.%y "
# setw -g window-status-format " #W#F "
# setw -g window-status-current-format " #W#F "
setw -g window-status-format " #W "
setw -g window-status-current-format " #W "
setw -g window-status-separator ""
#######################################
# colors, taken from vim-lucius
#######################################
set -g status-style "bg=#DADADA,fg=#000000"
setw -g window-status-style "bg=#BCBCBC,fg=#000000"
setw -g window-status-current-style "bg=#808080,fg=#ffffff"
setw -g window-status-activity-style "bg=#AFD7AF,fg=#000000"
setw -g window-status-bell-style "bg=#AFD7AF,fg=#000000"
#setw -g window-status-content-style "bg=#AFD7AF,fg=#000000"
set -g pane-active-border-style "bg=#eeeeee,fg=#006699"
set -g pane-border-style "bg=#eeeeee,fg=#999999"
'';
};
home.shellAliases = {
"o" = "tmuxp";
"ol" = "tmuxp load";
};
};
}