This commit is contained in:
2025-08-12 19:08:49 +00:00
parent f9a85fc581
commit 6cbfbd78c4
47 changed files with 188 additions and 175 deletions

View File

@@ -0,0 +1,24 @@
{
imports = [
./shell/aliases.nix
./shell/fish.nix
./shell/starship.nix
./shell/zsh.nix
./tools/atuin.nix
./tools/bat.nix
./tools/eza.nix
./tools/git.nix
./tools/lazygit.nix
./tools/mise.nix
./tools/ssh.nix
./tools/zellij.nix
./tools/zoxide.nix
./editors/neovim
];
programs.home-manager.enable = true;
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
}

View File

@@ -0,0 +1,47 @@
{
programs.nixvim = {
autoGroups = {
Christoph = {};
};
autoCmd = [
{
event = "BufWritePre";
group = "Christoph";
pattern = "*";
command = "%s/\\s\\+$//e";
}
{
event = "BufReadPost";
group = "Christoph";
pattern = "*";
command = "normal zR";
}
{
event = "FileReadPost";
group = "Christoph";
pattern = "*";
command = "normal zR";
}
{
event = "LspAttach";
group = "Christoph";
callback.__raw = ''
function(e)
local opts = { buffer = e.buf }
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
end
'';
}
];
};
}

View File

@@ -0,0 +1,26 @@
{
imports = [
./autocmd.nix
./mappings.nix
./options.nix
./plugins/conform.nix
./plugins/grug-far.nix
./plugins/lazygit.nix
./plugins/lsp.nix
./plugins/mini.nix
./plugins/treesitter.nix
];
programs.nixvim = {
enable = true;
defaultEditor = true;
luaLoader.enable = true;
colorschemes.catppuccin = {
enable = true;
settings = {
flavour = "latte";
};
};
};
}

View File

@@ -0,0 +1,165 @@
{
programs.nixvim.keymaps = [
# e - explore/edit
{
mode = "n";
key = "<leader>ed";
action = ":lua require('mini.files').open()<CR>";
options.desc = "Directory";
}
{
mode = "n";
key = "<leader>ef";
action = ":lua require('mini.files').open(vim.api.nvim_buf_get_name(0))<CR>";
options.desc = "File directory";
}
{
mode = "n";
key = "<leader>er";
action = ":lua require('grug-far').open()<CR>";
options.desc = "Search and replace";
}
# f - find
{
mode = "n";
key = "<leader>f/";
action = ":Pick history scope='/'<CR>";
options.desc = "'/' history";
}
{
mode = "n";
key = "<leader>f:";
action = ":Pick history scope=':'<CR>";
options.desc = "':' history";
}
{
mode = "n";
key = "<leader>fa";
action = ":Pick git_hunks scope='staged'<CR>";
options.desc = "Added hunks (all)";
}
{
mode = "n";
key = "<leader>fA";
action = ":Pick git_hunks path='%' scope='staged'<CR>";
options.desc = "Added hunks (buffer)";
}
{
mode = "n";
key = "<leader>fb";
action = ":Pick buffers<CR>";
options.desc = "Buffers";
}
{
mode = "n";
key = "<leader>fd";
action = ":Pick diagnostic scope='all'<CR>";
options.desc = "Diagnostic (workspace)";
}
{
mode = "n";
key = "<leader>fD";
action = ":Pick diagnostic scope='current'<CR>";
options.desc = "Diagnostic (buffer)";
}
{
mode = "n";
key = "<leader>ff";
action = ":Pick files<CR>";
options.desc = "Search files";
}
{
mode = "n";
key = "<leader>fg";
action = ":Pick grep_live<CR>";
options.desc = "Grep";
}
{
mode = "n";
key = "<leader>fr";
action = ":Pick lsp scope='references'<CR>";
options.desc = "References (LSP)";
}
{
mode = "n";
key = "<leader>fs";
action = ":Pick lsp scope='workspace_symbol'<CR>";
options.desc = "Symbols (LSP, workspace)";
}
{
mode = "n";
key = "<leader>fS";
action = ":Pick lsp scope='document_symbol'<CR>";
options.desc = "Symbols (LSP, buffer)";
}
# g - git
{
mode = "n";
key = "<leader>gg";
action = ":LazyGit<CR>";
options.desc = "Lazygit";
}
# l - lsp/formatter
{
mode = "n";
key = "<leader>la";
action = ":lua vim.lsp.buf.code_action()<CR>";
options.desc = "Actions";
}
{
mode = "n";
key = "<leader>ld";
action = ":lua vim.diagnostic.open_float()<CR>";
options.desc = "Diagnostics popup";
}
{
mode = "n";
key = "<leader>lf";
action = ":lua require('conform').format({ lsp_fallback = true })<CR>";
options.desc = "Format";
}
{
mode = "n";
key = "<leader>li";
action = ":lua vim.lsp.buf.hover()<CR>";
options.desc = "Information";
}
{
mode = "n";
key = "<leader>lj";
action = ":lua vim.diagnostic.goto_next()<CR>";
options.desc = "Next diagnostic";
}
{
mode = "n";
key = "<leader>lk";
action = ":lua vim.diagnostic.goto_prev()<CR>";
options.desc = "Prev diagnostic";
}
{
mode = "n";
key = "<leader>lr";
action = ":lua vim.lsp.buf.rename()<CR>";
options.desc = "Rename";
}
{
mode = "n";
key = "<leader>lR";
action = ":lua vim.lsp.buf.references()<CR>";
options.desc = "References";
}
{
mode = "n";
key = "<leader>ls";
action = ":lua vim.lsp.buf.definition()<CR>";
options.desc = "Source definition";
}
# other
{
mode = "n";
key = "sj";
action = ":lua require('mini.jump2d').start(require('mini.jump2d').builtin_opts.query)<CR>";
options.desc = "Jump to character";
}
];
}

View File

@@ -0,0 +1,16 @@
{
programs.nixvim = {
globals = {
# clipboard = "osc52";
};
opts = {
clipboard = "unnamedplus";
expandtab = true;
ignorecase = true;
mouse = "";
relativenumber = true;
shiftwidth = 2;
smartcase = true;
};
};
}

View File

@@ -0,0 +1,14 @@
{
programs.nixvim.plugins.conform-nvim = {
enable = true;
settings = {
format_on_save = {};
formatters_by_ft = {
nix = ["alejandra"];
javascript = ["prettier"];
typescript = ["prettier"];
elixir = ["mix"];
};
};
};
}

View File

@@ -0,0 +1,7 @@
{
programs.nixvim.plugins = {
grug-far = {
enable = true;
};
};
}

View File

@@ -0,0 +1,5 @@
{
programs.nixvim.plugins.lazygit = {
enable = true;
};
}

View File

@@ -0,0 +1,15 @@
{
programs.nixvim.plugins = {
lsp = {
enable = true;
inlayHints = true;
servers = {
nil_ls.enable = true; # Nix
ts_ls.enable = true; # TS/JS
cssls.enable = true; # CSS
dockerls.enable = true; # Docker
elixirls.enable = true; # Elixir
};
};
};
}

View File

@@ -0,0 +1,158 @@
{
programs.nixvim.plugins.mini = {
enable = true;
modules = {
ai = {
custom_textobjects = {
B.__raw = "require('mini.extra').gen_ai_spec.buffer()";
F.__raw = "require('mini.ai').gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' })";
};
};
align = {};
basics = {
options = {
basic = true;
extra_ui = true;
};
mappings = {
basic = false;
};
autocommands = {
basic = true;
};
};
bracketed = {};
clue = {
clues.__raw = ''
{
{ mode = 'n', keys = '<Leader>e', desc = '+Explore/+Edit' },
{ mode = 'n', keys = '<Leader>f', desc = '+Find' },
{ mode = 'n', keys = '<Leader>g', desc = '+Git' },
{ mode = 'n', keys = '<Leader>l', desc = '+LSP' },
{ mode = 'x', keys = '<Leader>l', desc = '+LSP' },
require("mini.clue").gen_clues.builtin_completion(),
require("mini.clue").gen_clues.g(),
require("mini.clue").gen_clues.marks(),
require("mini.clue").gen_clues.registers(),
require("mini.clue").gen_clues.windows({ submode_resize = true }),
require("mini.clue").gen_clues.z(),
}
'';
triggers = [
{
mode = "n";
keys = "<Leader>";
}
{
mode = "x";
keys = "<Leader>";
}
{
mode = "n";
keys = "[";
}
{
mode = "n";
keys = "]";
}
{
mode = "x";
keys = "[";
}
{
mode = "x";
keys = "]";
}
{
mode = "i";
keys = "<C-x>";
}
{
mode = "n";
keys = "g";
}
{
mode = "x";
keys = "g";
}
{
mode = "n";
keys = "\"";
}
{
mode = "x";
keys = "\"";
}
{
mode = "i";
keys = "<C-r>";
}
{
mode = "c";
keys = "<C-r>";
}
{
mode = "n";
keys = "<C-w>";
}
{
mode = "n";
keys = "z";
}
{
mode = "x";
keys = "z";
}
{
mode = "n";
keys = "'";
}
{
mode = "n";
keys = "`";
}
{
mode = "x";
keys = "'";
}
{
mode = "x";
keys = "`";
}
];
};
comment = {};
completion = {
lsp_completion = {
source_func = "omnifunc";
};
};
diff = {};
extra = {};
files = {};
git = {};
icons = {};
indentscope = {};
jump = {};
jump2d = {
settings = {
spotter.__raw = "require('mini.jump2d').gen_spotter.pattern('[^%s%p]+')";
labels = "asdfghjkl";
view = {
dim = true;
n_steps_ahead = 2;
};
};
};
move = {};
pairs = {};
pick = {};
starter = {};
statusline = {};
surround = {};
trailspace = {};
visits = {};
};
};
}

View File

@@ -0,0 +1,19 @@
{pkgs, ...}: {
programs.nixvim.plugins.treesitter = {
enable = true;
settings = {
highlight.enable = true;
indent.enable = true;
};
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
bash
fish
elixir
heex
json
nix
toml
yaml
];
};
}

View File

@@ -0,0 +1,6 @@
{
home.shellAliases = {
v = "nvim";
lg = "lazygit";
};
}

View File

@@ -0,0 +1,9 @@
{
programs.fish = {
enable = true;
interactiveShellInit = ''
set fish_greeting # Disable greeting
set -gx LS_COLORS "$(vivid generate catppuccin-latte)"
'';
};
}

View File

@@ -0,0 +1,34 @@
{lib, ...}: {
programs.starship = {
enable = true;
enableFishIntegration = true;
settings = {
add_newline = true;
command_timeout = 750;
format = lib.concatStrings [
"$directory"
"$git_branch"
"$git_status"
"$git_metrics"
"$line_break"
"$character"
];
character = {
success_symbol = "[](bold green)";
error_symbol = "[](bold red)";
};
git_branch = {
format = " [ $branch]($style) ";
};
git_metrics = {
disabled = false;
added_style = "bold green";
format = "[+$added]($added_style)/[-$deleted]($deleted_style) ";
};
};
};
}

View File

@@ -0,0 +1,5 @@
{
programs.zsh = {
enable = true;
};
}

View File

@@ -0,0 +1,6 @@
{
programs.atuin = {
enable = true;
enableFishIntegration = true;
};
}

View File

@@ -0,0 +1,20 @@
{pkgs, ...}: {
programs.bat = {
enable = true;
config = {
theme = "Catppuccin Latte";
pager = "ov";
};
themes = {
"Catppuccin Latte" = {
src = pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "bat";
rev = "6810349b28055dce54076712fc05fc68da4b8ec0";
sha256 = "lJapSgRVENTrbmpVyn+UQabC9fpV1G1e+CdlJ090uvg=";
};
file = "Themes/Catppuccin Latte.tmTheme";
};
};
};
}

View File

@@ -0,0 +1,6 @@
{
programs.eza = {
enable = true;
enableFishIntegration = true;
};
}

View File

@@ -0,0 +1,22 @@
{...}: let
name = "Christoph Schmatzler";
in {
programs.git = {
enable = true;
ignores = ["*.swp"];
userName = name;
lfs = {
enable = true;
};
extraConfig = {
init.defaultBranch = "main";
core = {
editor = "vim";
autocrlf = "input";
};
# commit.gpgsign = true;
pull.rebase = true;
rebase.autoStash = true;
};
};
}

View File

@@ -0,0 +1,43 @@
{
programs.lazygit = {
enable = true;
settings = {
gui = {
theme = {
activeBorderColor = [
"#8839ef"
"bold"
];
inactiveBorderColor = [
"#6c6f85"
];
optionsTextColor = [
"#1e66f5"
];
selectedLineBgColor = [
"#ccd0da"
];
cherryPickedCommitBgColor = [
"#bcc0cc"
];
cherryPickedCommitFgColor = [
"#8839ef"
];
unstagedChangesColor = [
"#d20f39"
];
defaultFgColor = [
"#4c4f69"
];
searchingActiveBorderColor = [
"#df8e1d"
];
};
authorColors = {
"*" = "#7287fd";
};
};
};
};
}

View File

@@ -0,0 +1,10 @@
{
programs.mise = {
enable = true;
enableFishIntegration = true;
enableZshIntegration = true;
settings = {
auto_install = false;
};
};
}

View File

@@ -0,0 +1,23 @@
{
pkgs,
lib,
user,
...
}: {
programs.ssh = {
enable = true;
includes = [
(lib.mkIf pkgs.stdenv.hostPlatform.isLinux "/home/${user}/.ssh/config_external")
(lib.mkIf pkgs.stdenv.hostPlatform.isDarwin "/Users/${user}/.ssh/config_external")
];
matchBlocks = {
"github.com" = {
identitiesOnly = true;
identityFile = [
(lib.mkIf pkgs.stdenv.hostPlatform.isLinux "/home/${user}/.ssh/id_ed25519")
(lib.mkIf pkgs.stdenv.hostPlatform.isDarwin "/Users/${user}/.ssh/id_ed25519")
];
};
};
};
}

View File

@@ -0,0 +1,18 @@
{
lib,
pkgs,
...
}: {
programs.zellij = {
enable = true;
enableFishIntegration = lib.mkDefault false;
settings = {
theme = "catppuccin-latte";
default_layout = "compact";
default_shell = "${pkgs.fish}/bin/fish";
no_pane_frames = true;
show_startup_tips = false;
show_release_notes = false;
};
};
}

View File

@@ -0,0 +1,6 @@
{
programs.zoxide = {
enable = true;
enableFishIntegration = true;
};
}