Use nixvim for neovim

This commit is contained in:
Fern Garden 2025-07-10 15:26:34 +08:00
parent 8d4a3f9769
commit d40b275d6c
3 changed files with 216 additions and 106 deletions

123
flake.lock generated
View file

@ -70,14 +70,17 @@
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1749398372,
"narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=",
"lastModified": 1751413152,
"narHash": "sha256-Tyw1RjYEsp5scoigs1384gIg6e0GoBVjms4aXFfRssQ=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569",
"rev": "77826244401ea9de6e3bac47c2db46005e1f30b5",
"type": "github"
},
"original": {
@ -142,6 +145,34 @@
"type": "github"
}
},
"ixx": {
"inputs": {
"flake-utils": [
"nixvim",
"nuschtosSearch",
"flake-utils"
],
"nixpkgs": [
"nixvim",
"nuschtosSearch",
"nixpkgs"
]
},
"locked": {
"lastModified": 1748294338,
"narHash": "sha256-FVO01jdmUNArzBS7NmaktLdGA5qA3lUMJ4B7a05Iynw=",
"owner": "NuschtOS",
"repo": "ixx",
"rev": "cc5f390f7caf265461d4aab37e98d2292ebbdb85",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"ref": "v0.0.8",
"repo": "ixx",
"type": "github"
}
},
"lanzaboote": {
"inputs": {
"crane": "crane",
@ -165,21 +196,6 @@
"type": "github"
}
},
"mnw": {
"locked": {
"lastModified": 1748710831,
"narHash": "sha256-eZu2yH3Y2eA9DD3naKWy/sTxYS5rPK2hO7vj8tvUCSU=",
"owner": "Gerg-L",
"repo": "mnw",
"rev": "cff958a4e050f8d917a6ff3a5624bc4681c6187d",
"type": "github"
},
"original": {
"owner": "Gerg-L",
"repo": "mnw",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1751432711,
@ -211,21 +227,6 @@
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1748740939,
"narHash": "sha256-rQaysilft1aVMwF14xIdGS3sj1yHlI6oKQNBRTF40cc=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "656a64127e9d791a334452c6b6606d17539476e2",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1751741127,
@ -244,15 +245,15 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1750215678,
"narHash": "sha256-Rc/ytpamXRf6z8UA2SGa4aaWxUXRbX2MAWIu2C8M+ok=",
"owner": "nixos",
"lastModified": 1751786137,
"narHash": "sha256-lIlUKVGCGsh0Q2EA7/6xRtKUZjaQ/ur8uUyY+MynHXQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5395fb3ab3f97b9b7abca147249fa2e8ed27b192",
"rev": "ceb24d94c6feaa4e8737a8e2bd3cf71c3a7eaaa0",
"type": "github"
},
"original": {
"owner": "nixos",
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
@ -274,25 +275,47 @@
"type": "github"
}
},
"nvf": {
"nixvim": {
"inputs": {
"flake-parts": "flake-parts_2",
"flake-utils": "flake-utils",
"mnw": "mnw",
"nixpkgs": "nixpkgs_3",
"nuschtosSearch": "nuschtosSearch",
"systems": "systems_2"
},
"locked": {
"lastModified": 1752001027,
"narHash": "sha256-JgP8lW4QBr9v/U4ETaIOMvGCd/DAA1AjZ1lqjIwfWno=",
"owner": "notashelf",
"repo": "nvf",
"rev": "c4d80273aaefeadaad96db97d077c647942b0e96",
"lastModified": 1752099138,
"narHash": "sha256-riX+IkcFhurR1M1vMEp2cdzraxsZEZl+XbpFWcgz3lU=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "2e24f8e62bc5da7e1ce81e2f2ff7d9e1f51350b7",
"type": "github"
},
"original": {
"owner": "notashelf",
"repo": "nvf",
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"nuschtosSearch": {
"inputs": {
"flake-utils": "flake-utils",
"ixx": "ixx",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1749730855,
"narHash": "sha256-L3x2nSlFkXkM6tQPLJP3oCBMIsRifhIDPMQQdHO5xWo=",
"owner": "NuschtOS",
"repo": "search",
"rev": "8dfe5879dd009ff4742b668d9c699bc4b9761742",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"repo": "search",
"type": "github"
}
},
@ -329,7 +352,7 @@
"lanzaboote": "lanzaboote",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2",
"nvf": "nvf",
"nixvim": "nixvim",
"secrets": "secrets",
"sops-nix": "sops-nix"
}

View file

@ -11,35 +11,32 @@
url = "git+ssh://git@docker.local:222/fern/secrets?ref=main";
flake = false;
};
nvf.url = "github:notashelf/nvf"; # Neovim.
nixvim.url = "github:nix-community/nixvim"; # Neovim.
# Packages.
fluffychat-2_0_0.url = "github:NixOS/nixpkgs?ref=pull/419632/head"; # FluffyChat 2.0.0
feishin-0_17_0.url = "github:NixOS/nixpkgs?ref=pull/414929/head"; # Feishin 0.17.0
};
outputs =
inputs@{
self,
nixpkgs,
lanzaboote,
nixos-hardware,
sops-nix,
nvf,
fluffychat-2_0_0,
feishin-0_17_0,
...
}:
with nixpkgs.lib;
let
mkHost =
{
hostname,
suite,
platform ? "x86_64-linux",
user ? "fern",
extraModules ? [ ],
}:
outputs = inputs @ {
self,
nixpkgs,
lanzaboote,
nixos-hardware,
sops-nix,
nixvim,
fluffychat-2_0_0,
feishin-0_17_0,
...
}:
with nixpkgs.lib; let
mkHost = {
hostname,
suite,
platform ? "x86_64-linux",
user ? "fern",
extraModules ? [],
}:
nixosSystem rec {
system = platform;
@ -56,6 +53,7 @@
specialArgs = {
inherit
self
hostname
suite
platform
@ -65,7 +63,7 @@
userPackages = {
fluffychat = fluffychat-2_0_0.legacyPackages.${system}.fluffychat;
feishin = feishin-0_17_0.legacyPackages.${system}.feishin;
webone = pkgs.callPackage ./packages/webone { };
webone = pkgs.callPackage ./packages/webone {};
};
secrets = builtins.toString inputs.secrets; # Secrets directory.
@ -73,7 +71,7 @@
modules =
[
nvf.nixosModules.default
nixvim.nixosModules.nixvim
./suites/common.nix
./suites/${suite}.nix
./hosts/${suite}/${hostname}.nix
@ -81,8 +79,7 @@
++ (filesystem.listFilesRecursive ./modules)
++ extraModules;
};
in
{
in {
nixosConfigurations = {
# Laptops.
muskduck = mkHost {

View file

@ -1,15 +1,18 @@
{
self,
pkgs,
lib,
hostname,
user,
...
}:
with lib;
{
with lib; {
# NixOS version.
system.stateVersion = "25.05";
# Set $NIX_PATH to flake input.
nix.nixPath = ["nixpkgs=${self.inputs.nixpkgs}"];
# Enable flakes.
nix.settings.experimental-features = [
"nix-command"
@ -97,42 +100,129 @@ with lib;
# Install some packages.
programs.git.enable = true;
programs.lazygit.enable = true;
programs.nvf = {
programs.nixvim = {
enable = true;
defaultEditor = true;
settings.vim = {
autocomplete.blink-cmp.enable = true;
undoFile.enable = true;
lineNumberMode = "number";
globals.mapleader = " ";
options = rec {
shiftwidth = 2;
tabstop = shiftwidth;
softtabstop = shiftwidth;
expandtab = true;
keymaps = [
{
key = "<Leader>t";
action = "<cmd> ToggleTerm direction=float <CR>";
mode = "n";
options = {
silent = true;
desc = "Open floating terminal.";
};
}
{
key = "<Leader>e";
action = "<cmd> Neotree toggle <CR>";
mode = "n";
options.desc = "Show/hide file browser.";
}
{
key = "<Leader>ff";
action = "<cmd> Telescope fd <CR>";
mode = "n";
options.desc = "Find files.";
}
];
colorschemes.kanagawa = {
enable = true;
settings = {
background.dark = "dragon";
colors.theme.all.ui.bg_gutter = "none";
overrides = ''
function(colors)
local theme = colors.theme
return {
NormalFloat = { bg = "none" },
FloatBorder = { bg = "none" },
FloatTitle = { bg = "none" },
TelescopeTitle = { fg = theme.ui.special, bold = true },
TelescopePromptNormal = { bg = theme.ui.bg_p1 },
TelescopePromptBorder = { fg = theme.ui.bg_p1, bg = theme.ui.bg_p1 },
TelescopeResultsNormal = { fg = theme.ui.fg_dim, bg = theme.ui.bg_m1 },
TelescopeResultsBorder = { fg = theme.ui.bg_m1, bg = theme.ui.bg_m1 },
TelescopePreviewNormal = { bg = theme.ui.bg_dim },
TelescopePreviewBorder = { bg = theme.ui.bg_dim, fg = theme.ui.bg_dim },
Pmenu = { fg = theme.ui.shade0, bg = theme.ui.bg_p1 }, -- add `blend = vim.o.pumblend` to enable transparency
PmenuSel = { fg = "NONE", bg = theme.ui.bg_p2 },
PmenuSbar = { bg = theme.ui.bg_m1 },
PmenuThumb = { bg = theme.ui.bg_p2 },
}
end,
'';
};
};
languages.nix = {
opts = rec {
shiftwidth = 2;
tabstop = shiftwidth;
softtabstop = shiftwidth;
expandtab = true;
number = true;
cursorline = true;
undofile = true;
clipboard = "unnamedplus";
};
clipboard.providers.wl-copy.enable = true;
plugins = {
blink-cmp = {
enable = true;
treesitter.enable = true;
lsp = {
enable = true;
server = "nixd";
};
format = {
enable = true;
type = "alejandra";
settings = {
keymap.preset = "enter";
menu.auto_show = true;
completion.documentation.auto_show = true;
};
};
extraPlugins = {
kanagawa-nvim = {
package = pkgs.vimPlugins.kanagawa-nvim;
setup = ''
require("kanagawa").load("dragon")
'';
bufferline.enable = true;
colorizer.enable = true;
gitsigns.enable = true;
lsp-format.enable = true;
neo-tree.enable = true;
notify.enable = true;
nvim-autopairs.enable = true;
telescope.enable = true;
trouble.enable = true;
toggleterm.enable = true;
web-devicons.enable = true;
which-key.enable = true;
lualine = {
enable = true;
settings.options.theme = "auto";
};
lsp = {
enable = true;
inlayHints = true;
servers = {
nixd = {
enable = true;
settings.formatting.command = ["alejandra"];
settings.options.nixos.expr = "(builtins.getFlake (builtins.toString /home/fern/Repositories/flock)).nixosConfigurations.muskduck.options";
};
};
};
treesitter = {
enable = true;
settings = {
highlight.enable = true;
incremental_selection.enable = true;
indent.enable = true;
};
};
};