{ pkgs, ... }: let nixvim = import ( builtins.fetchGit { url = "https://github.com/nix-community/nixvim"; ref = "nixos-24.11"; } ); in { #################### Git configuration #################### programs.git = { enable = true; lfs.enable = true; config = { user = { email = "vili.m.sinerva@gmail.com"; name = "Vili Sinervä"; signingkey = "DF8FEAF54EFAC996!"; }; merge = { ff = "true"; }; pull = { ff = "only"; }; commit = { verbose = "true"; }; commit.gpgsign = "true"; }; }; #################### Packages #################### environment.systemPackages = with pkgs; [ nixfmt-rfc-style nixd ]; fonts.packages = with pkgs; [ nerdfonts ]; #################### Neovim configuration #################### imports = [ nixvim.nixosModules.nixvim ]; programs.nixvim = { enable = true; defaultEditor = true; vimAlias = true; colorschemes.vscode.enable = true; globals.mapleader = " "; opts = { colorcolumn = "100"; cursorline = true; number = true; showcmd = true; signcolumn = "yes"; scrolloff = 16; shiftwidth = 3; tabstop = 3; }; keymaps = [ { key = "T"; action = "Neotree"; options.desc = "Open Neotree"; } { mode = [ "i" "v" ]; key = ""; action = ""; options.desc = "Exit To Normal Mode"; } { key = "b"; action = "Gitsigns toggle_current_line_blame"; options.desc = "Toggle Current Line Git Blame"; } ]; plugins = { fugitive.enable = true; gitsigns = { enable = true; settings = { current_line_blame_opts.delay = 100; numhl = true; }; }; lualine.enable = true; markdown-preview.enable = true; neo-tree = { enable = true; buffers.followCurrentFile = { enabled = true; leaveDirsOpen = true; }; }; nix.enable = true; rainbow-delimiters.enable = true; sleuth.enable = true; tmux-navigator = { enable = true; settings.no_mappings = 1; keymaps = [ { key = ""; action = "left"; options.desc = "Tmux Left"; } { key = ""; action = "down"; options.desc = "Tmux Down"; } { key = ""; action = "up"; options.desc = "Tmux Up"; } { key = ""; action = "right"; options.desc = "Tmux Right"; } ]; }; treesitter = { enable = true; folding = true; settings.indent.enable = true; nixGrammars = true; }; web-devicons.enable = true; which-key = { enable = true; settings.delay.__raw = '' function(ctx) return ctx.plugin and 0 or 500 end ''; }; cmp = { enable = true; settings = { sources = [ { name = "vim-vsnip"; } { name = "vim-lsp-signature-help"; } { name = "nvim-lsp"; } { name = "treesitter"; } { name = "buffer"; } ]; mapping = { "" = "cmp.mapping.complete()"; "" = "cmp.mapping.close()"; "" = "cmp.mapping.confirm({ select = true })"; "" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; }; }; }; friendly-snippets.enable = true; nvim-autopairs.enable = true; lsp = { enable = true; inlayHints = true; keymaps = { diagnostic = { "dj" = { action = "goto_next"; desc = "Next Diagnostic"; }; "dk" = { action = "goto_prev"; desc = "Previous Diagnostic"; }; "dh" = { action = "open_float"; desc = "Line Diagnostics"; }; }; lspBuf = { "gd" = { action = "definition"; desc = "Goto Definition"; }; "gr" = { action = "references"; desc = "Goto References"; }; "gD" = { action = "declaration"; desc = "Goto Declaration"; }; "gi" = { action = "implementation"; desc = "Goto Implementation"; }; "gt" = { action = "type_definition"; desc = "Type Definition"; }; "s" = { action = "workspace_symbol"; desc = "Search Symbol"; }; "r" = { action = "rename"; desc = "Rename Symbol"; }; "a" = { action = "code_action"; desc = "Code Action"; }; H = { action = "hover"; desc = "Hover"; }; }; extra = [ { action = "lua vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())"; key = "h"; options.desc = "Toggle LSP Inlay Hints"; } ]; }; servers = { clangd.enable = true; cmake.enable = true; dockerls.enable = true; docker_compose_language_service.enable = true; eslint.enable = true; html.enable = true; jsonls.enable = true; nixd.enable = true; pylsp.enable = true; rust_analyzer = { enable = true; installCargo = true; installRustc = true; settings = { completion = { autoimport.enable = true; autoself.enable = true; fullFunctionSignatures.enable = true; privateEditable.enable = true; }; diagnostics = { styleLints.enable = true; }; hover.actions.references.enable = true; }; }; yamlls.enable = true; }; }; lsp-format.enable = true; lsp-signature.enable = true; }; }; }