Add nixos config

This commit is contained in:
Martin Pander
2026-02-06 15:23:14 +01:00
parent 802c215d71
commit 0e00b8811a
24 changed files with 1754 additions and 14 deletions

23
nix/nixos/modules/dev.nix Normal file
View File

@@ -0,0 +1,23 @@
{ config, pkgs, ... }:
{
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
home.packages = with pkgs; [
visidata
bubblewrap
# TODO: Custom packages - need to verify availability or create derivations
# These packages were in the original configuration but may need custom setup:
# claude-code
# opencode
# gemini-cli
# Uncomment the above packages if they are available in your nixpkgs,
# or create custom derivations for them in a separate packages/ directory.
];
}

88
nix/nixos/modules/git.nix Normal file
View File

@@ -0,0 +1,88 @@
{ config, pkgs, ... }:
{
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"
];
};
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" "@-"];
};
};
};
}

View File

@@ -0,0 +1,86 @@
{ config, pkgs, lib, ... }:
{
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 ]))
];
initLua = builtins.concatStringsSep "\n" [
(lib.strings.fileContents ../../../nvim/base.lua)
(lib.strings.fileContents ../../../nvim/keymaps.lua)
(lib.strings.fileContents ../../../nvim/plugins.lua)
(lib.strings.fileContents ../../../nvim/filetype.lua)
];
};
home.packages = with pkgs; [
nodejs-slim
marksman
];
}

99
nix/nixos/modules/sh.nix Normal file
View File

@@ -0,0 +1,99 @@
{ config, pkgs, lib, ... }:
{
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"
"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 = ''
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";
};
}

View File

@@ -0,0 +1,75 @@
{config, pkgs, lib, ...}:
{
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
timewarrior
];
home.shellAliases = lib.mkMerge [ {
t = "task";
tt = "taskwarrior-tui";
tw = "timew";
tws = "timew summary :ids";
}
];
}

View File

@@ -0,0 +1,73 @@
{ config, pkgs, lib, ... }:
{
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-s display-popup -E "zsh ~/bin/tmuxp_selector.sh"
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"
# Note: The following keybindings had hard-coded WSL paths that were removed.
# Adjust the paths below to match your NixOS environment:
# 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";
};
}