feat(neovim): replace nixvim with programs.neovim (#336)

nixvim has been disabled for a long time (programs.nixvim.enable = false), so
drop the flake input (and prune flake.lock). Port the settings it carried to
Home Manager's programs.neovim: opts and per-plugin setup become an initLua
block plus a plugin list. The catppuccin module already provides the
colorscheme, vi stays unmapped, and the plain system neovim package is
untouched so sudo/nvim --clean keep using it.
This commit is contained in:
ryan4yin | 二花 authored and GitHub committed 2026-10-01 21:19:18 +08:00
1 parent 4909f6357b
commit 739cd171ba
3 files changed
+99 -153

No files matched your search

Generated
-60
View File
@@ -260,27 +260,6 @@
"type": "github"
}
},
"flake-parts_4": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1788450739,
"narHash": "sha256-glZLQlzIn1fXH6PazR2iUmTo7kzzyYSshrWhLS9TqCU=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "31729ca8cbdb4fa927b34e5f4353e6a83f39e993",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": [
@@ -748,29 +727,6 @@
"type": "github"
}
},
"nixvim": {
"inputs": {
"flake-parts": "flake-parts_4",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_3"
},
"locked": {
"lastModified": 1789311332,
"narHash": "sha256-JNsVNLux4emA7/BeZYzzAKnBaPnkatpaf/Fwf7PQT4E=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "0043fc97e267fee06ac0d858399ff6fac4242a92",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "nixos-26.05",
"repo": "nixvim",
"type": "github"
}
},
"nu_scripts": {
"flake": false,
"locked": {
@@ -910,7 +866,6 @@
"nixpkgs-master": "nixpkgs-master",
"nixpkgs-patched": "nixpkgs-patched",
"nixpkgs-stable": "nixpkgs-stable",
"nixvim": "nixvim",
"nu_scripts": "nu_scripts",
"nur-ryan4yin": "nur-ryan4yin",
"pre-commit-hooks": "pre-commit-hooks",
@@ -986,21 +941,6 @@
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
-5
View File
@@ -53,11 +53,6 @@
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim/nixos-26.05";
inputs.nixpkgs.follows = "nixpkgs";
};
# https://github.com/catppuccin/nix
# main carries the rust-overlay-style deprecation fix for its vscode
# package (nodejs -> nodejs-slim); v26.05 still emits the eval warning.
+99 -88
View File
@@ -1,105 +1,116 @@
{
config,
nixvim,
pkgs,
...
}:
let
# Parsers are bundled into the plugin, so no runtime `:TSInstall` is needed.
# Add a language here to get its treesitter highlighting and queries.
treesitter = pkgs.vimPlugins.nvim-treesitter.withPlugins (
p: with p; [
bash
go
json
lua
make
markdown
nix
nu
python
regex
rust
toml
vim
vimdoc
xml
yaml
]
);
in
{
# Neovim config, ported from the old `programs.nixvim` block. The colorscheme
# itself comes from `home/base/core/theme.nix` (catppuccin.nvim is enabled
# there and appends its own plugin + setup).
#
# The plain system package (modules/base/packages.nix) stays in place for
# privileged edits: `sudo` uses the system PATH, so
# `$SUDO_EDITOR = "nvim --clean"` keeps this user config out of root-owned
# files.
programs.neovim = {
enable = true;
vimAlias = true;
imports = [ nixvim.homeModules.nixvim ];
# No python/ruby plugins are configured; use the new explicit defaults
# instead of the legacy providers (and their deprecation warnings).
withPython3 = false;
withRuby = false;
programs.nixvim.nixpkgs.useGlobalPackages = true;
home.shellAliases = {
# Language servers started by `vim.lsp.enable` below; each must be on $PATH.
extraPackages = with pkgs; [
bash-language-server
gopls
nixd
pyright
rust-analyzer
];
vi = "nvim";
vim = "nvim";
};
plugins = [
pkgs.vimPlugins.neo-tree-nvim
pkgs.vimPlugins.nvim-lspconfig
pkgs.vimPlugins.nvim-web-devicons
treesitter
];
programs.nixvim = {
# temporarily disabled: nixvim's manpage pulls nixos-render-docs from nixpkgs,
# which is broken (patch fails to apply) on the current nixpkgs pin
enable = false;
initLua = ''
-- Editor options (previously `programs.nixvim.opts`).
local opt = vim.opt
opt.number = true
opt.relativenumber = true
opt.cursorline = true
opt.signcolumn = "auto"
opt.clipboard = "unnamedplus"
opt.scrolloff = 8
opt.swapfile = false
opt.title = true
opt.titlelen = 20
opt.smartindent = false
opt.mouse = "a"
opt.undofile = true
opt.ignorecase = true
opt.smartcase = true
opt.splitbelow = true
opt.splitright = true
opt.updatetime = 300
opt.wrap = true
opt.linebreak = true
clipboard.providers.wl-copy.enable = pkgs.stdenv.hostPlatform.isLinux;
-- Treesitter highlighting; parsers come from the bundled plugin.
-- `pcall` skips filetypes that have no parser available.
vim.api.nvim_create_autocmd("FileType", {
callback = function()
pcall(vim.treesitter.start)
end,
})
opts = {
number = true;
relativenumber = true;
cursorline = true;
signcolumn = "auto";
clipboard = "unnamedplus";
scrolloff = 8;
swapfile = false;
title = true;
titlelen = 20;
smartindent = false;
mouse = "a";
undofile = true;
ignorecase = true;
smartcase = true;
splitbelow = true;
splitright = true;
updatetime = 300;
wrap = true;
linebreak = true;
};
-- LSP: nvim-lspconfig ships the server definitions, Neovim starts them.
vim.lsp.enable({ "nixd", "rust_analyzer", "gopls", "pyright", "bashls" })
colorschemes.catppuccin = {
enable = true;
settings = {
transparent_background = true;
};
};
plugins.lsp.servers = {
nixd.enable = true;
"rust_analyzer" = {
enable = true;
installCargo = false;
installRustc = false;
};
gopls.enable = true;
pyright.enable = true;
bashls.enable = true;
};
plugins.treesitter = {
enable = true;
grammarPackages = with config.programs.nixvim.plugins.treesitter.package.builtGrammars; [
bash
json
lua
make
markdown
nix
regex
rust
go
python
toml
vim
vimdoc
xml
yaml
nu
];
};
plugins.neo-tree = {
enable = true;
settings = {
-- File explorer.
require("neo-tree").setup({
filesystem = {
filtered_items = {
visible = true;
hide_dotfiles = false;
hide_gitignored = false;
};
visible = true,
hide_dotfiles = false,
hide_gitignored = false,
},
follow_current_file = {
enabled = true;
leave_dirs_open = false;
};
};
};
};
enabled = true,
leave_dirs_open = false,
},
},
})
'';
};
# Matches the old `programs.nixvim.colorschemes.catppuccin.settings`.
catppuccin.nvim.settings.transparent_background = true;
}