From 09ae6daec055163b6219a1ec2dc0b4f69e5f2cba Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Tue, 10 Feb 2026 09:50:06 -0800 Subject: [PATCH 01/13] Beets, initial commit Sets up beets with my preferred defaults. Configures the program for the following plugins: - embedart - fetchart - ftintitle - info - lyrics - the --- hmModules/apps/beets/app.nix | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 hmModules/apps/beets/app.nix diff --git a/hmModules/apps/beets/app.nix b/hmModules/apps/beets/app.nix new file mode 100644 index 0000000..cb983ec --- /dev/null +++ b/hmModules/apps/beets/app.nix @@ -0,0 +1,52 @@ +{ config, pkgs, lib, ... }: + +{ + options.beets = { + enable = lib.mkEnableOption "Enables beets music"; + plugins = { + the.enable = lib.mkOption { default = true; }; + ftintitle.enable = lib.mkOption { default = true; }; + lyrics.enable = lib.mkOption { default = true; }; + fetchart = { + enable = lib.mkOption { default = true; }; + embed = lib.mkOption { default = true; }; + }; + }; + }; + + config = lib.mkIf config.beets.enable { + programs.beets.enable = true; + + programs.beets.settings = { + directory = "${config.xdg.userDirs.music}"; + library = "${config.xdg.userDirs.music}.db"; + + paths.default = with config.beets.plugins; let + # raw_artist = if ftintitle.enable + # then "$album_artist_no_feat" + # else "$albumartist"; + raw_artist = "$albumartist"; + artist = if the.enable + then "%the{${raw_artist}}/" + else raw_artist; + + the_rest = "$album%aunique{}/$track $title"; + in artist + the_rest; + + embedart = with config.beets.plugins.fetchart; + lib.mkIf (enable && embed) { + maxwidth = 500; + }; + + plugins = with lib; with config.beets.plugins; + optional (the.enable) "the" ++ + optional (ftintitle.enable) "ftintitle" ++ + optional (lyrics.enable) "lyrics" ++ + optional (fetchart.enable) "fetchart" ++ + optional (fetchart.embed) "embedart" ++ [ + "musicbrainz" + "info" + ]; + }; + }; +} From 2ebd936994e4b9a297e4bdc24cc661a741980404 Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Tue, 10 Feb 2026 10:44:05 -0800 Subject: [PATCH 02/13] Onizuka, remove beeper, add Beets --- users/onizuka/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/users/onizuka/default.nix b/users/onizuka/default.nix index fd6988c..f5ea837 100644 --- a/users/onizuka/default.nix +++ b/users/onizuka/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, ... }: { # "DP-2" = [ @@ -66,6 +66,7 @@ mpv.enable = true; zathura.enable = true; feh.enable = true; + beets.enable = true; neovim.enable = true; neovim.languages = { @@ -103,7 +104,6 @@ gimp.enable = true; - beeper.enable = true; discord.enable = true; lutris.enable = true; From f50a48a13669dde31ebb6b05fd3a7c49cf9ad2f2 Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Thu, 12 Feb 2026 14:37:08 -0800 Subject: [PATCH 03/13] Flake, add nixvim --- flake.lock | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 9 +++++++++ 2 files changed, 68 insertions(+) diff --git a/flake.lock b/flake.lock index 01c0331..23c561f 100644 --- a/flake.lock +++ b/flake.lock @@ -35,6 +35,27 @@ "type": "github" } }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1769996383, + "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "57928607ea566b5db3ad13af0e57e921e6b12381", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -142,6 +163,28 @@ "type": "github" } }, + "nixvim": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1770630823, + "narHash": "sha256-5SEmOnJ61vmbap39vzWEsCX5UQ+3Ul8J4mXWKdqSn3w=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "6acc964664ac916c64fe4e394edd467af4d90790", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, "root": { "inputs": { "easy-hosts": "easy-hosts", @@ -149,6 +192,7 @@ "home-manager": "home-manager", "niri": "niri", "nixpkgs": "nixpkgs", + "nixvim": "nixvim", "silentSDDM": "silentSDDM", "sops-nix": "sops-nix" } @@ -193,6 +237,21 @@ "type": "github" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "xwayland-satellite-stable": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index 936cb1d..25e28a5 100644 --- a/flake.nix +++ b/flake.nix @@ -2,6 +2,7 @@ outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } { imports = with inputs; [ easy-hosts.flakeModule + nixvim.homeModules.nixvim home-manager.flakeModules.home-manager ]; @@ -72,6 +73,7 @@ # inputs.lix.follows = "lix"; # }; + niri = { type = "github"; owner = "sodiboo"; @@ -79,6 +81,13 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + nixvim = { + type = "github"; + owner = "nix-community"; + repo = "nixvim"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + sops-nix = { type = "github"; owner = "Mic92"; From 826bb47ca5b4a4623cdc8d6750a2cd3a7909477c Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Wed, 18 Feb 2026 11:48:11 -0800 Subject: [PATCH 04/13] working on converting app.nix --- hmModules/apps/neovim.old/app.nix | 169 +++++++++++++ hmModules/apps/neovim.old/options.lua | 60 +++++ hmModules/apps/neovim.old/plugin/lsp.nix | 53 ++++ hmModules/apps/neovim.old/plugin/nvimcmp.nix | 72 ++++++ .../apps/neovim.old/plugin/telescope.nix | 43 ++++ .../apps/neovim.old/plugin/treesitter.nix | 38 +++ hmModules/apps/neovim/app.nix | 235 ++++++++---------- 7 files changed, 545 insertions(+), 125 deletions(-) create mode 100644 hmModules/apps/neovim.old/app.nix create mode 100644 hmModules/apps/neovim.old/options.lua create mode 100644 hmModules/apps/neovim.old/plugin/lsp.nix create mode 100644 hmModules/apps/neovim.old/plugin/nvimcmp.nix create mode 100644 hmModules/apps/neovim.old/plugin/telescope.nix create mode 100644 hmModules/apps/neovim.old/plugin/treesitter.nix diff --git a/hmModules/apps/neovim.old/app.nix b/hmModules/apps/neovim.old/app.nix new file mode 100644 index 0000000..d655103 --- /dev/null +++ b/hmModules/apps/neovim.old/app.nix @@ -0,0 +1,169 @@ +{ config, pkgs, lib, ... }: + +{ + options.neovim = { + enable = lib.mkEnableOption "Enables neovim"; + languages = { + c.enable = lib.mkEnableOption "Enables c support"; + go.enable = lib.mkEnableOption "Enables go support"; + nix.enable = lib.mkEnableOption "Enables nix support"; + rust.enable = lib.mkEnableOption "Enables rust support"; + typescript.enable = lib.mkEnableOption "Enables typescript support"; + }; + themes = { + catppuccin.enable = lib.mkEnableOption "Enables catppuccin theme"; + }; + plugins = { + comments.enable = lib.mkEnableOption "Enables nvim-comment"; + fugitive.enable = lib.mkEnableOption "Enables git-fugitive"; + lualine.enable = lib.mkEnableOption "Enables lualine"; + luasnip.enable = lib.mkEnableOption "Enables luasnip snippets"; + nvimcmp.enable = lib.mkEnableOption "Enables nvim completion"; + telescope = { + enable = lib.mkEnableOption "Enables telescope"; + fzf.enable = lib.mkEnableOption "Enables telescope-fzf"; + }; + treesitter.enable = lib.mkEnableOption "Enables treesitter"; + wiki.enable = lib.mkEnableOption "Enables a wiki"; + }; + }; + + imports = [ + ./plugin/lsp.nix + ./plugin/nvimcmp.nix + ./plugin/telescope.nix + ./plugin/treesitter.nix + ]; + + config = lib.mkIf config.neovim.enable { + home.sessionVariables = { + EDITOR = "nvim"; + VISUAL = "nvim"; + }; + + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + + extraLuaConfig = '' + ${builtins.readFile ./options.lua} + ''; + + extraPackages = with pkgs; [ + (lib.mkIf config.neovim.languages.c.enable libclang) + (lib.mkIf config.neovim.languages.go.enable gopls) + (lib.mkIf config.neovim.languages.nix.enable nil) + (lib.mkIf config.neovim.languages.rust.enable rust-analyzer) + ]; + + # Additional packages are added through imports + plugins = let + lopts = lib.lists.optionals; + cfgp = config.neovim.plugins; + cfgl = config.neovim.languages; + cfgt = config.neovim.themes; + + comments = lopts cfgp.comments.enable (with pkgs.vimPlugins; [ + { + plugin = comment-nvim; + type = "lua"; + config = "require(\"Comment\").setup()"; + } + ]); + + fugitive = lopts cfgp.fugitive.enable (with pkgs.vimPlugins; [ + vim-fugitive + ]); + + luasnip-pkg = lopts cfgp.luasnip.enable (with pkgs.vimPlugins; [ + luasnip + friendly-snippets + (lib.mkIf cfgp.nvimcmp.enable cmp_luasnip) + ]); + + lualine = lopts cfgp.lualine.enable (with pkgs.vimPlugins; [ + { + plugin = lualine-nvim; + type = "lua"; + config = '' + require("lualine").setup { + options = { + icons_enabled = true, + '' + lib.strings.optionalString cfgt.catppuccin.enable '' + theme = "catppuccin" + '' + '' + } + } + ''; + } + nvim-web-devicons + ]); + + nix-pkg = lopts cfgl.nix.enable (with pkgs.vimPlugins; [ + vim-nix + ]); + + rust-pkg = lopts cfgl.rust.enable (with pkgs.vimPlugins; [ + { + plugin = rustaceanvim; + type = "lua"; + config = '' + vim.g.rust_recommended_style = 0 + ''; + } + ]); + + go-pkg = lopts cfgl.go.enable (with pkgs.vimPlugins; [ + go-nvim + ]); + + typescript-pkg = lopts cfgl.typescript.enable (with pkgs.vimPlugins; [ + { + plugin = typescript-tools-nvim; + type = "lua"; + config = '' + require("typescript-tools").setup {} + ''; + } + ]); + + catppuccin-pkg = lopts cfgt.catppuccin.enable (with pkgs.vimPlugins; [ + { + plugin = catppuccin-nvim; + type = "lua"; + config = '' + vim.cmd.colorscheme "catppuccin-mocha" + require('catppuccin').setup({ + integrations = { + '' + lib.strings.optionalString cfgp.wiki.enable '' + vimwiki = true + '' + '' + } + }) + ''; + } + ]); + + wiki = lopts cfgp.wiki.enable (with pkgs.vimPlugins; [ + { + plugin = vimwiki; + type = "lua"; + config = '' + vim.g.vimwiki_list = { + { + path = '${config.xdg.userDirs.documents}/wiki', + links_space_char = '_', + ext = '.md', + syntax = 'markdown', + } + } + ''; + } + ]); + in comments ++ fugitive ++ luasnip-pkg ++ lualine ++ nix-pkg ++ rust-pkg + ++ go-pkg ++ wiki ++ catppuccin-pkg ++ typescript-pkg; + }; + }; +} diff --git a/hmModules/apps/neovim.old/options.lua b/hmModules/apps/neovim.old/options.lua new file mode 100644 index 0000000..db669e2 --- /dev/null +++ b/hmModules/apps/neovim.old/options.lua @@ -0,0 +1,60 @@ +-- Globals +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' +vim.opt.list = true +vim.bo.filetype = "on" +vim.opt.updatetime = 300 + +-- Indentations +vim.opt.tabstop = 2 +vim.opt.softtabstop = 0 +vim.opt.shiftwidth = 2 +vim.opt.smarttab = true +vim.opt.expandtab = true + +-- Style +vim.opt.colorcolumn = "80" +vim.opt.showmatch = true +vim.opt.number = true +vim.opt.relativenumber = true + +-- Easy Split Navigation +-- nnoremap +-- nnoremap +-- nnoremap +-- nnoremap + +-- Searching +vim.opt.smartcase = true + +-- Backups +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undofile = true +vim.opt.undodir = '/home/pan/.config/nvim/undodir' + +-- Error viewing +vim.keymap.set('n', 'd', function() vim.diagnostic.open_float() end) + +-- Easy copy and pasting to external programs +-- map "+yy +-- map "+P + +-- autocmd BufRead,BufNewFile *.md call WritingMode() +-- autocmd BufRead,BufNewFile *.tex call WritingMode() +-- autocmd BufRead,BufNewFile *.svx call WritingMode() + +-- autocmd BufRead,BufNewFile *.py call PythonMode() + +-- function! WritingMode() + -- setlocal textwidth=80 + -- setlocal wrap linebreak nolist + -- setlocal whichwrap+=<,>,h,l + -- nnoremap j gj + -- nnoremap k gk + -- setlocal spell spelllang=en_us +-- endfunction +-- function! PythonMode() + -- setlocal foldmethod=indent + -- setlocal foldlevel=99 +-- endfunction diff --git a/hmModules/apps/neovim.old/plugin/lsp.nix b/hmModules/apps/neovim.old/plugin/lsp.nix new file mode 100644 index 0000000..f5a66c5 --- /dev/null +++ b/hmModules/apps/neovim.old/plugin/lsp.nix @@ -0,0 +1,53 @@ +{ config, pkgs, lib, ... }: + +{ + config = lib.mkIf config.neovim.enable { + programs.neovim.plugins = let + cfgp = config.neovim.plugins; + cfgl = config.neovim.languages; + + configText = '' + local on_attach = function(_, bufnr) + + local bufmap = function(keys, func) + vim.keymap.set('n', keys, func, { buffer = bufnr }) + end + + bufmap('r', vim.lsp.buf.rename) + bufmap('a', vim.lsp.buf.code_action) + + bufmap('gd', vim.lsp.buf.definition) + bufmap('gD', vim.lsp.buf.declaration) + bufmap('gI', vim.lsp.buf.implementation) + bufmap('D', vim.lsp.buf.type_definition) + + '' + lib.strings.optionalString cfgp.telescope.enable '' + bufmap('gr', require('telescope.builtin').lsp_references) + bufmap('s', require('telescope.builtin').lsp_document_symbols) + bufmap('S', require('telescope.builtin').lsp_dynamic_workspace_symbols) + '' + '' + + bufmap('K', vim.lsp.buf.hover) + + vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) + vim.lsp.buf.format() + end, {}) + end + + local capabilities = vim.lsp.protocol.make_client_capabilities() + '' + lib.strings.optionalString cfgl.c.enable '' + require('lspconfig').clangd.setup {} + '' + lib.strings.optionalString cfgl.go.enable '' + require('lspconfig').gopls.setup {} + '' + lib.strings.optionalString cfgl.nix.enable '' + require('lspconfig').nil_ls.setup {} + ''; + in with pkgs.vimPlugins; [ + { + plugin = nvim-lspconfig; + type = "lua"; + config = configText; + } + ]; + }; +} diff --git a/hmModules/apps/neovim.old/plugin/nvimcmp.nix b/hmModules/apps/neovim.old/plugin/nvimcmp.nix new file mode 100644 index 0000000..82098ef --- /dev/null +++ b/hmModules/apps/neovim.old/plugin/nvimcmp.nix @@ -0,0 +1,72 @@ +{ config, pkgs, lib, ... }: + +let + cfgp = config.neovim.plugins; +in { + config = lib.mkIf (config.neovim.enable && cfgp.nvimcmp.enable) { + programs.neovim.plugins = let + + configText = '' + local cmp = require('cmp') + '' + lib.strings.optionalString cfgp.luasnip.enable '' + local luasnip = require('luasnip') + + require('luasnip.loaders.from_vscode').lazy_load() + luasnip.config.setup {} + '' + '' + + cmp.setup { + mapping = cmp.mapping.preset.insert { + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete {}, + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + '' + lib.strings.optionalString cfgp.luasnip.enable '' + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + '' + '' + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + '' + lib.strings.optionalString cfgp.luasnip.enable '' + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + '' + '' + else + fallback() + end + end, { 'i', 's' }), + }, + '' + lib.strings.optionalString cfgp.luasnip.enable '' + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + sources = { + { name = 'luasnip' }, + }, + '' + '' + } + ''; + in with pkgs.vimPlugins; [ + { + plugin = nvim-cmp; + type = "lua"; + config = configText; + } + ]; + }; +} diff --git a/hmModules/apps/neovim.old/plugin/telescope.nix b/hmModules/apps/neovim.old/plugin/telescope.nix new file mode 100644 index 0000000..48a96e9 --- /dev/null +++ b/hmModules/apps/neovim.old/plugin/telescope.nix @@ -0,0 +1,43 @@ +{ config, pkgs, lib, ... }: + +let + cfgp = config.neovim.plugins; +in { + config = lib.mkIf (config.neovim.enable && cfgp.telescope.enable) { + programs.neovim.plugins = let + configText = '' + require('telescope').setup({ + extensions = { + '' + lib.strings.optionalString cfgp.telescope.fzf.enable '' + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + } + '' + '' + } + }) + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'ff', builtin.find_files, {}) + vim.keymap.set('n', 'fg', builtin.git_files, {}) + + '' + lib.strings.optionalString cfgp.telescope.fzf.enable '' + require('telescope').load_extension('fzf') + ''; + in with pkgs.vimPlugins; [ + { + plugin = telescope-nvim; + type = "lua"; + config = configText; + } + (lib.mkIf cfgp.nvimcmp.enable telescope-fzf-native-nvim) + ]; + + home.packages = with pkgs; [ + (lib.mkIf cfgp.telescope.fzf.enable fzf) + ]; + + }; +} diff --git a/hmModules/apps/neovim.old/plugin/treesitter.nix b/hmModules/apps/neovim.old/plugin/treesitter.nix new file mode 100644 index 0000000..a6bb8c0 --- /dev/null +++ b/hmModules/apps/neovim.old/plugin/treesitter.nix @@ -0,0 +1,38 @@ +{ config, pkgs, lib, ... }: + +let + cfgp = config.neovim.plugins; + cfgl = config.neovim.languages; +in { + config = lib.mkIf (config.neovim.enable && cfgp.treesitter.enable) { + programs.neovim.plugins = let + configText = '' + require('nvim-treesitter.configs').setup { + ensure_installed = {}, + + auto_install = false, + + highlight = { enable = true }, + + indent = { enable = true }, + } + ''; + + # I've tried many things, and can't get treesitter plugins changing + # dynamically. For not just have them always loaded regardless of config + treeplugs = p: [ + p.tree-sitter-c + p.tree-sitter-go + p.tree-sitter-nix + p.tree-sitter-rust + p.tree-sitter-typescript + ]; + in with pkgs.vimPlugins; [ + { + plugin = (nvim-treesitter.withPlugins treeplugs); + type = "lua"; + config = configText; + } + ]; + }; +} diff --git a/hmModules/apps/neovim/app.nix b/hmModules/apps/neovim/app.nix index d655103..6d078ae 100644 --- a/hmModules/apps/neovim/app.nix +++ b/hmModules/apps/neovim/app.nix @@ -28,12 +28,12 @@ }; }; - imports = [ - ./plugin/lsp.nix - ./plugin/nvimcmp.nix - ./plugin/telescope.nix - ./plugin/treesitter.nix - ]; + # imports = [ + # ./plugin/lsp.nix + # ./plugin/nvimcmp.nix + # ./plugin/telescope.nix + # ./plugin/treesitter.nix + # ]; config = lib.mkIf config.neovim.enable { home.sessionVariables = { @@ -41,129 +41,114 @@ VISUAL = "nvim"; }; - programs.neovim = { + programs.nixvim = { enable = true; viAlias = true; vimAlias = true; vimdiffAlias = true; - - extraLuaConfig = '' - ${builtins.readFile ./options.lua} - ''; - - extraPackages = with pkgs; [ - (lib.mkIf config.neovim.languages.c.enable libclang) - (lib.mkIf config.neovim.languages.go.enable gopls) - (lib.mkIf config.neovim.languages.nix.enable nil) - (lib.mkIf config.neovim.languages.rust.enable rust-analyzer) - ]; - - # Additional packages are added through imports - plugins = let - lopts = lib.lists.optionals; - cfgp = config.neovim.plugins; - cfgl = config.neovim.languages; - cfgt = config.neovim.themes; - - comments = lopts cfgp.comments.enable (with pkgs.vimPlugins; [ - { - plugin = comment-nvim; - type = "lua"; - config = "require(\"Comment\").setup()"; - } - ]); - - fugitive = lopts cfgp.fugitive.enable (with pkgs.vimPlugins; [ - vim-fugitive - ]); - - luasnip-pkg = lopts cfgp.luasnip.enable (with pkgs.vimPlugins; [ - luasnip - friendly-snippets - (lib.mkIf cfgp.nvimcmp.enable cmp_luasnip) - ]); - - lualine = lopts cfgp.lualine.enable (with pkgs.vimPlugins; [ - { - plugin = lualine-nvim; - type = "lua"; - config = '' - require("lualine").setup { - options = { - icons_enabled = true, - '' + lib.strings.optionalString cfgt.catppuccin.enable '' - theme = "catppuccin" - '' + '' - } - } - ''; - } - nvim-web-devicons - ]); - - nix-pkg = lopts cfgl.nix.enable (with pkgs.vimPlugins; [ - vim-nix - ]); - - rust-pkg = lopts cfgl.rust.enable (with pkgs.vimPlugins; [ - { - plugin = rustaceanvim; - type = "lua"; - config = '' - vim.g.rust_recommended_style = 0 - ''; - } - ]); - - go-pkg = lopts cfgl.go.enable (with pkgs.vimPlugins; [ - go-nvim - ]); - - typescript-pkg = lopts cfgl.typescript.enable (with pkgs.vimPlugins; [ - { - plugin = typescript-tools-nvim; - type = "lua"; - config = '' - require("typescript-tools").setup {} - ''; - } - ]); - - catppuccin-pkg = lopts cfgt.catppuccin.enable (with pkgs.vimPlugins; [ - { - plugin = catppuccin-nvim; - type = "lua"; - config = '' - vim.cmd.colorscheme "catppuccin-mocha" - require('catppuccin').setup({ - integrations = { - '' + lib.strings.optionalString cfgp.wiki.enable '' - vimwiki = true - '' + '' - } - }) - ''; - } - ]); - - wiki = lopts cfgp.wiki.enable (with pkgs.vimPlugins; [ - { - plugin = vimwiki; - type = "lua"; - config = '' - vim.g.vimwiki_list = { - { - path = '${config.xdg.userDirs.documents}/wiki', - links_space_char = '_', - ext = '.md', - syntax = 'markdown', - } - } - ''; - } - ]); - in comments ++ fugitive ++ luasnip-pkg ++ lualine ++ nix-pkg ++ rust-pkg - ++ go-pkg ++ wiki ++ catppuccin-pkg ++ typescript-pkg; }; + # extraLuaConfig = '' + # ${builtins.readFile ./options.lua} + # ''; + + programs.nixvim.colorschemes = with config.neovim.themes; { + catppuccin = lib.mkIf catppuccin.enable { + enable = true; + flavour = "mocha"; + integrations.vimwiki = lib.mkIf wiki.enable true; + } + }; + + programs.nixvim.plugins = with config.neovim.plugins; { + comment.enable = comments.enable; + + fugitive.enable = fugitive.enable; + + lualine = lib.mkIf lualine.enable { + enable = true; + icons_enabled = true; + }; + web-devicons.enable = lualine.enable; + + luasnip.enable = luasnip.enable; + friendly-snippets.enable = luasnip.enable; + + cmp = { + enable = nvimcmp.enable; + autoEnableSources = true; + settings.sources = lib.options luasnip.enable { name = "cmp-luasnip" }; + }; + + + + + # telescope = { + # enable = lib.mkEnableOption "Enables telescope"; + # fzf.enable = lib.mkEnableOption "Enables telescope-fzf"; + # }; + # treesitter.enable = lib.mkEnableOption "Enables treesitter"; + # wiki.enable = lib.mkEnableOption "Enables a wiki"; + # + # + # wiki = lopts cfgp.wiki.enable (with pkgs.vimPlugins; [ + # { + # plugin = vimwiki; + # type = "lua"; + # config = '' + # vim.g.vimwiki_list = { + # { + # path = '${config.xdg.userDirs.documents}/wiki', + # links_space_char = '_', + # ext = '.md', + # syntax = 'markdown', + # } + # } + # ''; + # } + # ]); + } + + # extraPackages = with pkgs; [ + # (lib.mkIf config.neovim.languages.c.enable libclang) + # (lib.mkIf config.neovim.languages.go.enable gopls) + # (lib.mkIf config.neovim.languages.nix.enable nil) + # (lib.mkIf config.neovim.languages.rust.enable rust-analyzer) + # ]; + # + # # Additional packages are added through imports + # plugins = let + # lopts = lib.lists.optionals; + # cfgp = config.neovim.plugins; + # cfgl = config.neovim.languages; + # cfgt = config.neovim.themes; + # + # nix-pkg = lopts cfgl.nix.enable (with pkgs.vimPlugins; [ + # vim-nix + # ]); + # + # rust-pkg = lopts cfgl.rust.enable (with pkgs.vimPlugins; [ + # { + # plugin = rustaceanvim; + # type = "lua"; + # config = '' + # vim.g.rust_recommended_style = 0 + # ''; + # } + # ]); + # + # go-pkg = lopts cfgl.go.enable (with pkgs.vimPlugins; [ + # go-nvim + # ]); + # + # typescript-pkg = lopts cfgl.typescript.enable (with pkgs.vimPlugins; [ + # { + # plugin = typescript-tools-nvim; + # type = "lua"; + # config = '' + # require("typescript-tools").setup {} + # ''; + # } + # ]); + # }; }; } From 4d72b7a14173ec456ae7c433cf0e57f47499f4c1 Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Wed, 18 Feb 2026 12:36:16 -0800 Subject: [PATCH 05/13] Converted app.nix --- hmModules/apps/neovim/app.nix | 109 ++++++++++++---------------------- 1 file changed, 38 insertions(+), 71 deletions(-) diff --git a/hmModules/apps/neovim/app.nix b/hmModules/apps/neovim/app.nix index 6d078ae..e559634 100644 --- a/hmModules/apps/neovim/app.nix +++ b/hmModules/apps/neovim/app.nix @@ -50,6 +50,7 @@ # extraLuaConfig = '' # ${builtins.readFile ./options.lua} # ''; + # vim.g.rust_recommended_style = 0 programs.nixvim.colorschemes = with config.neovim.themes; { catppuccin = lib.mkIf catppuccin.enable { @@ -61,9 +62,9 @@ programs.nixvim.plugins = with config.neovim.plugins; { comment.enable = comments.enable; - + fugitive.enable = fugitive.enable; - + lualine = lib.mkIf lualine.enable { enable = true; icons_enabled = true; @@ -76,79 +77,45 @@ cmp = { enable = nvimcmp.enable; autoEnableSources = true; - settings.sources = lib.options luasnip.enable { name = "cmp-luasnip" }; + settings.sources = [ + { name = "nvim_lsp"; } + { name = "path"; } + { name = "buffer"; } + ] + lib.options luasnip.enable { name = "cmp-luasnip" }; }; - + telescope.enable = telescope.enable; + # telescope.fzf.enable = lib.mkEnableOption "Enables telescope-fzf"; + treesitter.enable = treesiter.enable; - # telescope = { - # enable = lib.mkEnableOption "Enables telescope"; - # fzf.enable = lib.mkEnableOption "Enables telescope-fzf"; - # }; - # treesitter.enable = lib.mkEnableOption "Enables treesitter"; - # wiki.enable = lib.mkEnableOption "Enables a wiki"; - # - # - # wiki = lopts cfgp.wiki.enable (with pkgs.vimPlugins; [ - # { - # plugin = vimwiki; - # type = "lua"; - # config = '' - # vim.g.vimwiki_list = { - # { - # path = '${config.xdg.userDirs.documents}/wiki', - # links_space_char = '_', - # ext = '.md', - # syntax = 'markdown', - # } - # } - # ''; - # } - # ]); - } + vimwiki = { + enable = wiki.enable; + list = [ + { + path = "${config.xdg.userDirs.documents}/wiki"; + links_space_char = "_"; + ext = ".md"; + syntax = "markdown"; + } + ]; + }; + }; - # extraPackages = with pkgs; [ - # (lib.mkIf config.neovim.languages.c.enable libclang) - # (lib.mkIf config.neovim.languages.go.enable gopls) - # (lib.mkIf config.neovim.languages.nix.enable nil) - # (lib.mkIf config.neovim.languages.rust.enable rust-analyzer) - # ]; - # - # # Additional packages are added through imports - # plugins = let - # lopts = lib.lists.optionals; - # cfgp = config.neovim.plugins; - # cfgl = config.neovim.languages; - # cfgt = config.neovim.themes; - # - # nix-pkg = lopts cfgl.nix.enable (with pkgs.vimPlugins; [ - # vim-nix - # ]); - # - # rust-pkg = lopts cfgl.rust.enable (with pkgs.vimPlugins; [ - # { - # plugin = rustaceanvim; - # type = "lua"; - # config = '' - # vim.g.rust_recommended_style = 0 - # ''; - # } - # ]); - # - # go-pkg = lopts cfgl.go.enable (with pkgs.vimPlugins; [ - # go-nvim - # ]); - # - # typescript-pkg = lopts cfgl.typescript.enable (with pkgs.vimPlugins; [ - # { - # plugin = typescript-tools-nvim; - # type = "lua"; - # config = '' - # require("typescript-tools").setup {} - # ''; - # } - # ]); - # }; + programs.nixvim.plugins = with config.neovim.languages; { + nix.enable = nix.enable; + rustaceanvim.enable = rust.enable; + typsecript-tools.enable = typescript.enable; + }; + programs.nixvim.lsp = { + enable = true; + servers = with config.neovim.languages; { + clangd.enable = c.enable; + gopls.enable = go.enable; + nil_ls.enable = nix.enable; + rust_analyzer.enable = rust.enable; + tsserver.enable = typescript.enable; + }; + }; }; } From a86ffded19ff5a7a345c31fbe1d5d123e5ae98a1 Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Wed, 18 Feb 2026 12:52:16 -0800 Subject: [PATCH 06/13] merged lsp into app.nix --- hmModules/apps/neovim/app.nix | 12 +++++++ hmModules/apps/neovim/plugin/lsp.nix | 53 ---------------------------- 2 files changed, 12 insertions(+), 53 deletions(-) delete mode 100644 hmModules/apps/neovim/plugin/lsp.nix diff --git a/hmModules/apps/neovim/app.nix b/hmModules/apps/neovim/app.nix index e559634..67e46a4 100644 --- a/hmModules/apps/neovim/app.nix +++ b/hmModules/apps/neovim/app.nix @@ -102,6 +102,7 @@ }; }; + programs.nixvim.plugins.nvim-lspconfig.enable = true; programs.nixvim.plugins = with config.neovim.languages; { nix.enable = nix.enable; rustaceanvim.enable = rust.enable; @@ -116,6 +117,17 @@ rust_analyzer.enable = rust.enable; tsserver.enable = typescript.enable; }; + keymaps = [ + { key = "gd"; lspBufAction = "definition"; } + { key = "gD"; lspBufAction = "declaration"; } + { key = "gi"; lspBufAction = "implementation"; } + { key = "gt"; lspBufAction = "type_definition"; } + { key = "K"; lspBufAction = "hover"; } + ] + lib.options config.neovim.plugins.telescope.enable { + key = "gr"; + action = lib.nixvim.mkRaw + "require('telescope.builtin').lsp_references"; + }; }; }; } diff --git a/hmModules/apps/neovim/plugin/lsp.nix b/hmModules/apps/neovim/plugin/lsp.nix deleted file mode 100644 index f5a66c5..0000000 --- a/hmModules/apps/neovim/plugin/lsp.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - config = lib.mkIf config.neovim.enable { - programs.neovim.plugins = let - cfgp = config.neovim.plugins; - cfgl = config.neovim.languages; - - configText = '' - local on_attach = function(_, bufnr) - - local bufmap = function(keys, func) - vim.keymap.set('n', keys, func, { buffer = bufnr }) - end - - bufmap('r', vim.lsp.buf.rename) - bufmap('a', vim.lsp.buf.code_action) - - bufmap('gd', vim.lsp.buf.definition) - bufmap('gD', vim.lsp.buf.declaration) - bufmap('gI', vim.lsp.buf.implementation) - bufmap('D', vim.lsp.buf.type_definition) - - '' + lib.strings.optionalString cfgp.telescope.enable '' - bufmap('gr', require('telescope.builtin').lsp_references) - bufmap('s', require('telescope.builtin').lsp_document_symbols) - bufmap('S', require('telescope.builtin').lsp_dynamic_workspace_symbols) - '' + '' - - bufmap('K', vim.lsp.buf.hover) - - vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) - vim.lsp.buf.format() - end, {}) - end - - local capabilities = vim.lsp.protocol.make_client_capabilities() - '' + lib.strings.optionalString cfgl.c.enable '' - require('lspconfig').clangd.setup {} - '' + lib.strings.optionalString cfgl.go.enable '' - require('lspconfig').gopls.setup {} - '' + lib.strings.optionalString cfgl.nix.enable '' - require('lspconfig').nil_ls.setup {} - ''; - in with pkgs.vimPlugins; [ - { - plugin = nvim-lspconfig; - type = "lua"; - config = configText; - } - ]; - }; -} From 3d0b82e9c728c9db1bb76d6a8da3fc18ddab3333 Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Wed, 18 Feb 2026 13:12:02 -0800 Subject: [PATCH 07/13] merged nvimcmp to app.nix --- hmModules/apps/neovim/app.nix | 40 +++++++++++++ hmModules/apps/neovim/plugin/nvimcmp.nix | 72 ------------------------ 2 files changed, 40 insertions(+), 72 deletions(-) delete mode 100644 hmModules/apps/neovim/plugin/nvimcmp.nix diff --git a/hmModules/apps/neovim/app.nix b/hmModules/apps/neovim/app.nix index 67e46a4..b996294 100644 --- a/hmModules/apps/neovim/app.nix +++ b/hmModules/apps/neovim/app.nix @@ -82,6 +82,46 @@ { name = "path"; } { name = "buffer"; } ] + lib.options luasnip.enable { name = "cmp-luasnip" }; + + mapping = { + "" = "cmp.mapping.complete {}"; + "" = "cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }"; + "" = { + actions = '' + function(fallback) + if cmp.visible() then + cmp.select_next_item() + '' + lib.optionalString luasnip.enable '' + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + '' + '' + else + fallback() + end + end + ''; + modes = [ "i" "s" ]; + }; + "" = { + actions = '' + function(fallback) + if cmp.visible() then + cmp.select_prev_item() + '' + lib.optionalString luasnip.enable '' + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + '' + '' + else + fallback() + end + end + ''; + modes = [ "i" "s" ]; + }; + }; }; telescope.enable = telescope.enable; diff --git a/hmModules/apps/neovim/plugin/nvimcmp.nix b/hmModules/apps/neovim/plugin/nvimcmp.nix deleted file mode 100644 index 82098ef..0000000 --- a/hmModules/apps/neovim/plugin/nvimcmp.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ config, pkgs, lib, ... }: - -let - cfgp = config.neovim.plugins; -in { - config = lib.mkIf (config.neovim.enable && cfgp.nvimcmp.enable) { - programs.neovim.plugins = let - - configText = '' - local cmp = require('cmp') - '' + lib.strings.optionalString cfgp.luasnip.enable '' - local luasnip = require('luasnip') - - require('luasnip.loaders.from_vscode').lazy_load() - luasnip.config.setup {} - '' + '' - - cmp.setup { - mapping = cmp.mapping.preset.insert { - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete {}, - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - '' + lib.strings.optionalString cfgp.luasnip.enable '' - elseif luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - '' + '' - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - '' + lib.strings.optionalString cfgp.luasnip.enable '' - elseif luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - '' + '' - else - fallback() - end - end, { 'i', 's' }), - }, - '' + lib.strings.optionalString cfgp.luasnip.enable '' - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - sources = { - { name = 'luasnip' }, - }, - '' + '' - } - ''; - in with pkgs.vimPlugins; [ - { - plugin = nvim-cmp; - type = "lua"; - config = configText; - } - ]; - }; -} From 849cc08db49753d615b3291c2ee65d55ae5699d6 Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Wed, 18 Feb 2026 13:50:18 -0800 Subject: [PATCH 08/13] merged telescope into app.nix --- hmModules/apps/neovim/app.nix | 23 ++++++++---- hmModules/apps/neovim/plugin/telescope.nix | 43 ---------------------- 2 files changed, 16 insertions(+), 50 deletions(-) delete mode 100644 hmModules/apps/neovim/plugin/telescope.nix diff --git a/hmModules/apps/neovim/app.nix b/hmModules/apps/neovim/app.nix index b996294..1fabccd 100644 --- a/hmModules/apps/neovim/app.nix +++ b/hmModules/apps/neovim/app.nix @@ -28,12 +28,7 @@ }; }; - # imports = [ - # ./plugin/lsp.nix - # ./plugin/nvimcmp.nix - # ./plugin/telescope.nix # ./plugin/treesitter.nix - # ]; config = lib.mkIf config.neovim.enable { home.sessionVariables = { @@ -124,8 +119,22 @@ }; }; - telescope.enable = telescope.enable; - # telescope.fzf.enable = lib.mkEnableOption "Enables telescope-fzf"; + telescope = { + enable = telescope.enable; + keymaps = [ + { key = "ff"; action = "find_files"; } + { key = "fg"; action = "git_files"; } + ]; + extensions = { + fzf = lib.mkIf telescope.fzf.enable { + enable = true; + fuzzy = true; + override_generic_sorter = true; + override_file_sorter = true; + case_mode = "smart_case"; + }; + }; + }; treesitter.enable = treesiter.enable; diff --git a/hmModules/apps/neovim/plugin/telescope.nix b/hmModules/apps/neovim/plugin/telescope.nix deleted file mode 100644 index 48a96e9..0000000 --- a/hmModules/apps/neovim/plugin/telescope.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ config, pkgs, lib, ... }: - -let - cfgp = config.neovim.plugins; -in { - config = lib.mkIf (config.neovim.enable && cfgp.telescope.enable) { - programs.neovim.plugins = let - configText = '' - require('telescope').setup({ - extensions = { - '' + lib.strings.optionalString cfgp.telescope.fzf.enable '' - fzf = { - fuzzy = true, -- false will only do exact matching - override_generic_sorter = true, -- override the generic sorter - override_file_sorter = true, -- override the file sorter - case_mode = "smart_case", -- or "ignore_case" or "respect_case" - -- the default case_mode is "smart_case" - } - '' + '' - } - }) - local builtin = require('telescope.builtin') - vim.keymap.set('n', 'ff', builtin.find_files, {}) - vim.keymap.set('n', 'fg', builtin.git_files, {}) - - '' + lib.strings.optionalString cfgp.telescope.fzf.enable '' - require('telescope').load_extension('fzf') - ''; - in with pkgs.vimPlugins; [ - { - plugin = telescope-nvim; - type = "lua"; - config = configText; - } - (lib.mkIf cfgp.nvimcmp.enable telescope-fzf-native-nvim) - ]; - - home.packages = with pkgs; [ - (lib.mkIf cfgp.telescope.fzf.enable fzf) - ]; - - }; -} From f3aad89088593132ef5e3d68385f48ade705c5a2 Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Wed, 18 Feb 2026 14:00:28 -0800 Subject: [PATCH 09/13] merge treesitter into app.nix I'm uncertain if I moved the plugins over (I think they are all enabled by default) --- hmModules/apps/neovim/app.nix | 9 +++-- hmModules/apps/neovim/plugin/treesitter.nix | 38 --------------------- 2 files changed, 6 insertions(+), 41 deletions(-) delete mode 100644 hmModules/apps/neovim/plugin/treesitter.nix diff --git a/hmModules/apps/neovim/app.nix b/hmModules/apps/neovim/app.nix index 1fabccd..d61b7a4 100644 --- a/hmModules/apps/neovim/app.nix +++ b/hmModules/apps/neovim/app.nix @@ -28,8 +28,6 @@ }; }; - # ./plugin/treesitter.nix - config = lib.mkIf config.neovim.enable { home.sessionVariables = { EDITOR = "nvim"; @@ -136,7 +134,12 @@ }; }; - treesitter.enable = treesiter.enable; + treesitter = { + enable = treesiter.enable; + highlight.enable = true; + indent.enable = true; + folding.enable = true; + }; vimwiki = { enable = wiki.enable; diff --git a/hmModules/apps/neovim/plugin/treesitter.nix b/hmModules/apps/neovim/plugin/treesitter.nix deleted file mode 100644 index a6bb8c0..0000000 --- a/hmModules/apps/neovim/plugin/treesitter.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ config, pkgs, lib, ... }: - -let - cfgp = config.neovim.plugins; - cfgl = config.neovim.languages; -in { - config = lib.mkIf (config.neovim.enable && cfgp.treesitter.enable) { - programs.neovim.plugins = let - configText = '' - require('nvim-treesitter.configs').setup { - ensure_installed = {}, - - auto_install = false, - - highlight = { enable = true }, - - indent = { enable = true }, - } - ''; - - # I've tried many things, and can't get treesitter plugins changing - # dynamically. For not just have them always loaded regardless of config - treeplugs = p: [ - p.tree-sitter-c - p.tree-sitter-go - p.tree-sitter-nix - p.tree-sitter-rust - p.tree-sitter-typescript - ]; - in with pkgs.vimPlugins; [ - { - plugin = (nvim-treesitter.withPlugins treeplugs); - type = "lua"; - config = configText; - } - ]; - }; -} From 935c75b459ee11dc2433cfa4cf81686df80b33af Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Wed, 18 Feb 2026 14:24:41 -0800 Subject: [PATCH 10/13] Merged options.lua into app.nix --- hmModules/apps/neovim/app.nix | 50 +++++++++++++++++++++++--- hmModules/apps/neovim/options.lua | 60 ------------------------------- 2 files changed, 46 insertions(+), 64 deletions(-) delete mode 100644 hmModules/apps/neovim/options.lua diff --git a/hmModules/apps/neovim/app.nix b/hmModules/apps/neovim/app.nix index d61b7a4..d32e52e 100644 --- a/hmModules/apps/neovim/app.nix +++ b/hmModules/apps/neovim/app.nix @@ -39,11 +39,53 @@ viAlias = true; vimAlias = true; vimdiffAlias = true; + + globals = { + mapleader = " "; + maplocalleader = " "; + rust_recommended_style = 0; + }; + + options = { + list = true; + updatetime = 750; + + tabstop = 2; + softtabstop = 0; + shiftwidth = 2; + smarttab = true; + expandtab = true; + + colorcolumn = "81"; + showmatch = true; + number = true; + relativenumber = true; + + swapfile = false; + backup = false; + undofile = true; + undodir = "${config.xdg.configHome}/nvim/undodir"; + + smartcase = true; + }; + + keymaps = [ + { + key = "d"; + mode = "n"; + action = "vim.diagnostic.open_float()"; + } + # -- Easy Split Navigation + # -- nnoremap + # -- nnoremap + # -- nnoremap + # -- nnoremap + # + # -- Easy copy and pasting to external programs + # -- map "+yy + # -- map "+P + ]; }; - # extraLuaConfig = '' - # ${builtins.readFile ./options.lua} - # ''; - # vim.g.rust_recommended_style = 0 programs.nixvim.colorschemes = with config.neovim.themes; { catppuccin = lib.mkIf catppuccin.enable { diff --git a/hmModules/apps/neovim/options.lua b/hmModules/apps/neovim/options.lua deleted file mode 100644 index db669e2..0000000 --- a/hmModules/apps/neovim/options.lua +++ /dev/null @@ -1,60 +0,0 @@ --- Globals -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' -vim.opt.list = true -vim.bo.filetype = "on" -vim.opt.updatetime = 300 - --- Indentations -vim.opt.tabstop = 2 -vim.opt.softtabstop = 0 -vim.opt.shiftwidth = 2 -vim.opt.smarttab = true -vim.opt.expandtab = true - --- Style -vim.opt.colorcolumn = "80" -vim.opt.showmatch = true -vim.opt.number = true -vim.opt.relativenumber = true - --- Easy Split Navigation --- nnoremap --- nnoremap --- nnoremap --- nnoremap - --- Searching -vim.opt.smartcase = true - --- Backups -vim.opt.swapfile = false -vim.opt.backup = false -vim.opt.undofile = true -vim.opt.undodir = '/home/pan/.config/nvim/undodir' - --- Error viewing -vim.keymap.set('n', 'd', function() vim.diagnostic.open_float() end) - --- Easy copy and pasting to external programs --- map "+yy --- map "+P - --- autocmd BufRead,BufNewFile *.md call WritingMode() --- autocmd BufRead,BufNewFile *.tex call WritingMode() --- autocmd BufRead,BufNewFile *.svx call WritingMode() - --- autocmd BufRead,BufNewFile *.py call PythonMode() - --- function! WritingMode() - -- setlocal textwidth=80 - -- setlocal wrap linebreak nolist - -- setlocal whichwrap+=<,>,h,l - -- nnoremap j gj - -- nnoremap k gk - -- setlocal spell spelllang=en_us --- endfunction --- function! PythonMode() - -- setlocal foldmethod=indent - -- setlocal foldlevel=99 --- endfunction From c82d15375ca4766896bf7a0847d90f2a8efb9372 Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Wed, 18 Feb 2026 14:28:42 -0800 Subject: [PATCH 11/13] Set up defaults for plugins --- hmModules/apps/neovim/app.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hmModules/apps/neovim/app.nix b/hmModules/apps/neovim/app.nix index d32e52e..d4ad8ca 100644 --- a/hmModules/apps/neovim/app.nix +++ b/hmModules/apps/neovim/app.nix @@ -14,17 +14,17 @@ catppuccin.enable = lib.mkEnableOption "Enables catppuccin theme"; }; plugins = { - comments.enable = lib.mkEnableOption "Enables nvim-comment"; - fugitive.enable = lib.mkEnableOption "Enables git-fugitive"; - lualine.enable = lib.mkEnableOption "Enables lualine"; - luasnip.enable = lib.mkEnableOption "Enables luasnip snippets"; - nvimcmp.enable = lib.mkEnableOption "Enables nvim completion"; + comments.enable = lib.mkOption { default = true; }; + fugitive.enable = lib.mkOption { default = true; }; + lualine.enable = lib.mkOption { default = true; }; + luasnip.enable = lib.mkOption { default = false; }; + nvimcmp.enable = lib.mkOption { default = true; }; telescope = { - enable = lib.mkEnableOption "Enables telescope"; - fzf.enable = lib.mkEnableOption "Enables telescope-fzf"; + enable = lib.mkOption { default = true; }; + fzf.enable = lib.mkOption { default = true; }; }; - treesitter.enable = lib.mkEnableOption "Enables treesitter"; - wiki.enable = lib.mkEnableOption "Enables a wiki"; + treesitter.enable = lib.mkOption { default = true; }; + wiki.enable = lib.mkOption { default = false; }; }; }; From 80241ccb6bf78eb1d0899e9139164138ec6a793a Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Wed, 18 Feb 2026 14:30:01 -0800 Subject: [PATCH 12/13] Onizuka, update neovim config to match update --- users/onizuka/default.nix | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/users/onizuka/default.nix b/users/onizuka/default.nix index f5ea837..ade362c 100644 --- a/users/onizuka/default.nix +++ b/users/onizuka/default.nix @@ -68,27 +68,16 @@ feh.enable = true; beets.enable = true; - neovim.enable = true; - neovim.languages = { - c.enable = true; - nix.enable = true; - rust.enable = true; - typescript.enable = true; - }; - neovim.plugins = { - comments.enable = true; - fugitive.enable = true; - lualine.enable = true; - luasnip.enable = true; - nvimcmp.enable = true; - telescope = { - enable = true; - fzf.enable = true; + neovim = { + enable = true; + languages = { + c.enable = true; + nix.enable = true; + rust.enable = true; + typescript.enable = true; }; - treesitter.enable = true; - wiki.enable = true; + themes.catppuccin.enable = true; }; - neovim.themes.catppuccin.enable = true; lf.enable = true; lf.hiddenfiles = [ From 819aff7644b3f40573346ea122587ab25eb1b7e8 Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Wed, 18 Feb 2026 16:08:12 -0800 Subject: [PATCH 13/13] Fix nixvim and delete old files --- flake.nix | 6 +- hmModules/apps/neovim.old/app.nix | 169 ------------------ hmModules/apps/neovim.old/options.lua | 60 ------- hmModules/apps/neovim.old/plugin/lsp.nix | 53 ------ hmModules/apps/neovim.old/plugin/nvimcmp.nix | 72 -------- .../apps/neovim.old/plugin/telescope.nix | 43 ----- .../apps/neovim.old/plugin/treesitter.nix | 38 ---- hmModules/apps/neovim/app.nix | 36 ++-- 8 files changed, 21 insertions(+), 456 deletions(-) delete mode 100644 hmModules/apps/neovim.old/app.nix delete mode 100644 hmModules/apps/neovim.old/options.lua delete mode 100644 hmModules/apps/neovim.old/plugin/lsp.nix delete mode 100644 hmModules/apps/neovim.old/plugin/nvimcmp.nix delete mode 100644 hmModules/apps/neovim.old/plugin/telescope.nix delete mode 100644 hmModules/apps/neovim.old/plugin/treesitter.nix diff --git a/flake.nix b/flake.nix index 25e28a5..78058f9 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,6 @@ outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } { imports = with inputs; [ easy-hosts.flakeModule - nixvim.homeModules.nixvim home-manager.flakeModules.home-manager ]; @@ -26,7 +25,10 @@ inputs.home-manager.lib.homeManagerConfiguration { extraSpecialArgs = { inherit inputs; }; pkgs = inputs.nixpkgs.legacyPackages.${system}; - modules = [ ./hmModules ] ++ extraModules; + modules = [ + ./hmModules + inputs.nixvim.homeModules.nixvim + ] ++ extraModules; }; in { "pan@juri" = userConfig "x86_64-linux" [ ./users/juri ]; diff --git a/hmModules/apps/neovim.old/app.nix b/hmModules/apps/neovim.old/app.nix deleted file mode 100644 index d655103..0000000 --- a/hmModules/apps/neovim.old/app.nix +++ /dev/null @@ -1,169 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - options.neovim = { - enable = lib.mkEnableOption "Enables neovim"; - languages = { - c.enable = lib.mkEnableOption "Enables c support"; - go.enable = lib.mkEnableOption "Enables go support"; - nix.enable = lib.mkEnableOption "Enables nix support"; - rust.enable = lib.mkEnableOption "Enables rust support"; - typescript.enable = lib.mkEnableOption "Enables typescript support"; - }; - themes = { - catppuccin.enable = lib.mkEnableOption "Enables catppuccin theme"; - }; - plugins = { - comments.enable = lib.mkEnableOption "Enables nvim-comment"; - fugitive.enable = lib.mkEnableOption "Enables git-fugitive"; - lualine.enable = lib.mkEnableOption "Enables lualine"; - luasnip.enable = lib.mkEnableOption "Enables luasnip snippets"; - nvimcmp.enable = lib.mkEnableOption "Enables nvim completion"; - telescope = { - enable = lib.mkEnableOption "Enables telescope"; - fzf.enable = lib.mkEnableOption "Enables telescope-fzf"; - }; - treesitter.enable = lib.mkEnableOption "Enables treesitter"; - wiki.enable = lib.mkEnableOption "Enables a wiki"; - }; - }; - - imports = [ - ./plugin/lsp.nix - ./plugin/nvimcmp.nix - ./plugin/telescope.nix - ./plugin/treesitter.nix - ]; - - config = lib.mkIf config.neovim.enable { - home.sessionVariables = { - EDITOR = "nvim"; - VISUAL = "nvim"; - }; - - programs.neovim = { - enable = true; - viAlias = true; - vimAlias = true; - vimdiffAlias = true; - - extraLuaConfig = '' - ${builtins.readFile ./options.lua} - ''; - - extraPackages = with pkgs; [ - (lib.mkIf config.neovim.languages.c.enable libclang) - (lib.mkIf config.neovim.languages.go.enable gopls) - (lib.mkIf config.neovim.languages.nix.enable nil) - (lib.mkIf config.neovim.languages.rust.enable rust-analyzer) - ]; - - # Additional packages are added through imports - plugins = let - lopts = lib.lists.optionals; - cfgp = config.neovim.plugins; - cfgl = config.neovim.languages; - cfgt = config.neovim.themes; - - comments = lopts cfgp.comments.enable (with pkgs.vimPlugins; [ - { - plugin = comment-nvim; - type = "lua"; - config = "require(\"Comment\").setup()"; - } - ]); - - fugitive = lopts cfgp.fugitive.enable (with pkgs.vimPlugins; [ - vim-fugitive - ]); - - luasnip-pkg = lopts cfgp.luasnip.enable (with pkgs.vimPlugins; [ - luasnip - friendly-snippets - (lib.mkIf cfgp.nvimcmp.enable cmp_luasnip) - ]); - - lualine = lopts cfgp.lualine.enable (with pkgs.vimPlugins; [ - { - plugin = lualine-nvim; - type = "lua"; - config = '' - require("lualine").setup { - options = { - icons_enabled = true, - '' + lib.strings.optionalString cfgt.catppuccin.enable '' - theme = "catppuccin" - '' + '' - } - } - ''; - } - nvim-web-devicons - ]); - - nix-pkg = lopts cfgl.nix.enable (with pkgs.vimPlugins; [ - vim-nix - ]); - - rust-pkg = lopts cfgl.rust.enable (with pkgs.vimPlugins; [ - { - plugin = rustaceanvim; - type = "lua"; - config = '' - vim.g.rust_recommended_style = 0 - ''; - } - ]); - - go-pkg = lopts cfgl.go.enable (with pkgs.vimPlugins; [ - go-nvim - ]); - - typescript-pkg = lopts cfgl.typescript.enable (with pkgs.vimPlugins; [ - { - plugin = typescript-tools-nvim; - type = "lua"; - config = '' - require("typescript-tools").setup {} - ''; - } - ]); - - catppuccin-pkg = lopts cfgt.catppuccin.enable (with pkgs.vimPlugins; [ - { - plugin = catppuccin-nvim; - type = "lua"; - config = '' - vim.cmd.colorscheme "catppuccin-mocha" - require('catppuccin').setup({ - integrations = { - '' + lib.strings.optionalString cfgp.wiki.enable '' - vimwiki = true - '' + '' - } - }) - ''; - } - ]); - - wiki = lopts cfgp.wiki.enable (with pkgs.vimPlugins; [ - { - plugin = vimwiki; - type = "lua"; - config = '' - vim.g.vimwiki_list = { - { - path = '${config.xdg.userDirs.documents}/wiki', - links_space_char = '_', - ext = '.md', - syntax = 'markdown', - } - } - ''; - } - ]); - in comments ++ fugitive ++ luasnip-pkg ++ lualine ++ nix-pkg ++ rust-pkg - ++ go-pkg ++ wiki ++ catppuccin-pkg ++ typescript-pkg; - }; - }; -} diff --git a/hmModules/apps/neovim.old/options.lua b/hmModules/apps/neovim.old/options.lua deleted file mode 100644 index db669e2..0000000 --- a/hmModules/apps/neovim.old/options.lua +++ /dev/null @@ -1,60 +0,0 @@ --- Globals -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' -vim.opt.list = true -vim.bo.filetype = "on" -vim.opt.updatetime = 300 - --- Indentations -vim.opt.tabstop = 2 -vim.opt.softtabstop = 0 -vim.opt.shiftwidth = 2 -vim.opt.smarttab = true -vim.opt.expandtab = true - --- Style -vim.opt.colorcolumn = "80" -vim.opt.showmatch = true -vim.opt.number = true -vim.opt.relativenumber = true - --- Easy Split Navigation --- nnoremap --- nnoremap --- nnoremap --- nnoremap - --- Searching -vim.opt.smartcase = true - --- Backups -vim.opt.swapfile = false -vim.opt.backup = false -vim.opt.undofile = true -vim.opt.undodir = '/home/pan/.config/nvim/undodir' - --- Error viewing -vim.keymap.set('n', 'd', function() vim.diagnostic.open_float() end) - --- Easy copy and pasting to external programs --- map "+yy --- map "+P - --- autocmd BufRead,BufNewFile *.md call WritingMode() --- autocmd BufRead,BufNewFile *.tex call WritingMode() --- autocmd BufRead,BufNewFile *.svx call WritingMode() - --- autocmd BufRead,BufNewFile *.py call PythonMode() - --- function! WritingMode() - -- setlocal textwidth=80 - -- setlocal wrap linebreak nolist - -- setlocal whichwrap+=<,>,h,l - -- nnoremap j gj - -- nnoremap k gk - -- setlocal spell spelllang=en_us --- endfunction --- function! PythonMode() - -- setlocal foldmethod=indent - -- setlocal foldlevel=99 --- endfunction diff --git a/hmModules/apps/neovim.old/plugin/lsp.nix b/hmModules/apps/neovim.old/plugin/lsp.nix deleted file mode 100644 index f5a66c5..0000000 --- a/hmModules/apps/neovim.old/plugin/lsp.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - config = lib.mkIf config.neovim.enable { - programs.neovim.plugins = let - cfgp = config.neovim.plugins; - cfgl = config.neovim.languages; - - configText = '' - local on_attach = function(_, bufnr) - - local bufmap = function(keys, func) - vim.keymap.set('n', keys, func, { buffer = bufnr }) - end - - bufmap('r', vim.lsp.buf.rename) - bufmap('a', vim.lsp.buf.code_action) - - bufmap('gd', vim.lsp.buf.definition) - bufmap('gD', vim.lsp.buf.declaration) - bufmap('gI', vim.lsp.buf.implementation) - bufmap('D', vim.lsp.buf.type_definition) - - '' + lib.strings.optionalString cfgp.telescope.enable '' - bufmap('gr', require('telescope.builtin').lsp_references) - bufmap('s', require('telescope.builtin').lsp_document_symbols) - bufmap('S', require('telescope.builtin').lsp_dynamic_workspace_symbols) - '' + '' - - bufmap('K', vim.lsp.buf.hover) - - vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) - vim.lsp.buf.format() - end, {}) - end - - local capabilities = vim.lsp.protocol.make_client_capabilities() - '' + lib.strings.optionalString cfgl.c.enable '' - require('lspconfig').clangd.setup {} - '' + lib.strings.optionalString cfgl.go.enable '' - require('lspconfig').gopls.setup {} - '' + lib.strings.optionalString cfgl.nix.enable '' - require('lspconfig').nil_ls.setup {} - ''; - in with pkgs.vimPlugins; [ - { - plugin = nvim-lspconfig; - type = "lua"; - config = configText; - } - ]; - }; -} diff --git a/hmModules/apps/neovim.old/plugin/nvimcmp.nix b/hmModules/apps/neovim.old/plugin/nvimcmp.nix deleted file mode 100644 index 82098ef..0000000 --- a/hmModules/apps/neovim.old/plugin/nvimcmp.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ config, pkgs, lib, ... }: - -let - cfgp = config.neovim.plugins; -in { - config = lib.mkIf (config.neovim.enable && cfgp.nvimcmp.enable) { - programs.neovim.plugins = let - - configText = '' - local cmp = require('cmp') - '' + lib.strings.optionalString cfgp.luasnip.enable '' - local luasnip = require('luasnip') - - require('luasnip.loaders.from_vscode').lazy_load() - luasnip.config.setup {} - '' + '' - - cmp.setup { - mapping = cmp.mapping.preset.insert { - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete {}, - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - '' + lib.strings.optionalString cfgp.luasnip.enable '' - elseif luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - '' + '' - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - '' + lib.strings.optionalString cfgp.luasnip.enable '' - elseif luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - '' + '' - else - fallback() - end - end, { 'i', 's' }), - }, - '' + lib.strings.optionalString cfgp.luasnip.enable '' - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - sources = { - { name = 'luasnip' }, - }, - '' + '' - } - ''; - in with pkgs.vimPlugins; [ - { - plugin = nvim-cmp; - type = "lua"; - config = configText; - } - ]; - }; -} diff --git a/hmModules/apps/neovim.old/plugin/telescope.nix b/hmModules/apps/neovim.old/plugin/telescope.nix deleted file mode 100644 index 48a96e9..0000000 --- a/hmModules/apps/neovim.old/plugin/telescope.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ config, pkgs, lib, ... }: - -let - cfgp = config.neovim.plugins; -in { - config = lib.mkIf (config.neovim.enable && cfgp.telescope.enable) { - programs.neovim.plugins = let - configText = '' - require('telescope').setup({ - extensions = { - '' + lib.strings.optionalString cfgp.telescope.fzf.enable '' - fzf = { - fuzzy = true, -- false will only do exact matching - override_generic_sorter = true, -- override the generic sorter - override_file_sorter = true, -- override the file sorter - case_mode = "smart_case", -- or "ignore_case" or "respect_case" - -- the default case_mode is "smart_case" - } - '' + '' - } - }) - local builtin = require('telescope.builtin') - vim.keymap.set('n', 'ff', builtin.find_files, {}) - vim.keymap.set('n', 'fg', builtin.git_files, {}) - - '' + lib.strings.optionalString cfgp.telescope.fzf.enable '' - require('telescope').load_extension('fzf') - ''; - in with pkgs.vimPlugins; [ - { - plugin = telescope-nvim; - type = "lua"; - config = configText; - } - (lib.mkIf cfgp.nvimcmp.enable telescope-fzf-native-nvim) - ]; - - home.packages = with pkgs; [ - (lib.mkIf cfgp.telescope.fzf.enable fzf) - ]; - - }; -} diff --git a/hmModules/apps/neovim.old/plugin/treesitter.nix b/hmModules/apps/neovim.old/plugin/treesitter.nix deleted file mode 100644 index a6bb8c0..0000000 --- a/hmModules/apps/neovim.old/plugin/treesitter.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ config, pkgs, lib, ... }: - -let - cfgp = config.neovim.plugins; - cfgl = config.neovim.languages; -in { - config = lib.mkIf (config.neovim.enable && cfgp.treesitter.enable) { - programs.neovim.plugins = let - configText = '' - require('nvim-treesitter.configs').setup { - ensure_installed = {}, - - auto_install = false, - - highlight = { enable = true }, - - indent = { enable = true }, - } - ''; - - # I've tried many things, and can't get treesitter plugins changing - # dynamically. For not just have them always loaded regardless of config - treeplugs = p: [ - p.tree-sitter-c - p.tree-sitter-go - p.tree-sitter-nix - p.tree-sitter-rust - p.tree-sitter-typescript - ]; - in with pkgs.vimPlugins; [ - { - plugin = (nvim-treesitter.withPlugins treeplugs); - type = "lua"; - config = configText; - } - ]; - }; -} diff --git a/hmModules/apps/neovim/app.nix b/hmModules/apps/neovim/app.nix index d4ad8ca..29c03ae 100644 --- a/hmModules/apps/neovim/app.nix +++ b/hmModules/apps/neovim/app.nix @@ -38,7 +38,6 @@ enable = true; viAlias = true; vimAlias = true; - vimdiffAlias = true; globals = { mapleader = " "; @@ -46,7 +45,7 @@ rust_recommended_style = 0; }; - options = { + opts = { list = true; updatetime = 750; @@ -92,7 +91,7 @@ enable = true; flavour = "mocha"; integrations.vimwiki = lib.mkIf wiki.enable true; - } + }; }; programs.nixvim.plugins = with config.neovim.plugins; { @@ -116,7 +115,7 @@ { name = "nvim_lsp"; } { name = "path"; } { name = "buffer"; } - ] + lib.options luasnip.enable { name = "cmp-luasnip" }; + ] ++ lib.optional luasnip.enable { name = "cmp-luasnip"; }; mapping = { "" = "cmp.mapping.complete {}"; @@ -161,10 +160,10 @@ telescope = { enable = telescope.enable; - keymaps = [ - { key = "ff"; action = "find_files"; } - { key = "fg"; action = "git_files"; } - ]; + keymaps = { + "ff" = "find_files"; + "fg" = "git_files"; + }; extensions = { fzf = lib.mkIf telescope.fzf.enable { enable = true; @@ -177,7 +176,7 @@ }; treesitter = { - enable = treesiter.enable; + enable = treesitter.enable; highlight.enable = true; indent.enable = true; folding.enable = true; @@ -194,14 +193,13 @@ } ]; }; + + nvim-lspconfig.enable = true; + nix.enable = config.neovim.languages.nix.enable; + rustaceanvim.enable = config.neovim.languages.rust.enable; + typsecript-tools.enable = config.neovim.languages.typescript.enable; }; - programs.nixvim.plugins.nvim-lspconfig.enable = true; - programs.nixvim.plugins = with config.neovim.languages; { - nix.enable = nix.enable; - rustaceanvim.enable = rust.enable; - typsecript-tools.enable = typescript.enable; - }; programs.nixvim.lsp = { enable = true; servers = with config.neovim.languages; { @@ -217,10 +215,10 @@ { key = "gi"; lspBufAction = "implementation"; } { key = "gt"; lspBufAction = "type_definition"; } { key = "K"; lspBufAction = "hover"; } - ] + lib.options config.neovim.plugins.telescope.enable { - key = "gr"; - action = lib.nixvim.mkRaw - "require('telescope.builtin').lsp_references"; + ] ++ lib.optional config.neovim.plugins.telescope.enable { + key = "gr"; + action = config.lib.nixvim.mkRaw + "require('telescope.builtin').lsp_references"; }; }; };