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": { "flake-parts_2": {
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1749398372, "lastModified": 1751413152,
"narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=", "narHash": "sha256-Tyw1RjYEsp5scoigs1384gIg6e0GoBVjms4aXFfRssQ=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569", "rev": "77826244401ea9de6e3bac47c2db46005e1f30b5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -142,6 +145,34 @@
"type": "github" "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": { "lanzaboote": {
"inputs": { "inputs": {
"crane": "crane", "crane": "crane",
@ -165,21 +196,6 @@
"type": "github" "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": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1751432711, "lastModified": 1751432711,
@ -211,21 +227,6 @@
"type": "github" "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": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1751741127, "lastModified": 1751741127,
@ -244,15 +245,15 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1750215678, "lastModified": 1751786137,
"narHash": "sha256-Rc/ytpamXRf6z8UA2SGa4aaWxUXRbX2MAWIu2C8M+ok=", "narHash": "sha256-lIlUKVGCGsh0Q2EA7/6xRtKUZjaQ/ur8uUyY+MynHXQ=",
"owner": "nixos", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5395fb3ab3f97b9b7abca147249fa2e8ed27b192", "rev": "ceb24d94c6feaa4e8737a8e2bd3cf71c3a7eaaa0",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "NixOS",
"ref": "nixpkgs-unstable", "ref": "nixpkgs-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
@ -274,25 +275,47 @@
"type": "github" "type": "github"
} }
}, },
"nvf": { "nixvim": {
"inputs": { "inputs": {
"flake-parts": "flake-parts_2", "flake-parts": "flake-parts_2",
"flake-utils": "flake-utils",
"mnw": "mnw",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",
"nuschtosSearch": "nuschtosSearch",
"systems": "systems_2" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1752001027, "lastModified": 1752099138,
"narHash": "sha256-JgP8lW4QBr9v/U4ETaIOMvGCd/DAA1AjZ1lqjIwfWno=", "narHash": "sha256-riX+IkcFhurR1M1vMEp2cdzraxsZEZl+XbpFWcgz3lU=",
"owner": "notashelf", "owner": "nix-community",
"repo": "nvf", "repo": "nixvim",
"rev": "c4d80273aaefeadaad96db97d077c647942b0e96", "rev": "2e24f8e62bc5da7e1ce81e2f2ff7d9e1f51350b7",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "notashelf", "owner": "nix-community",
"repo": "nvf", "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" "type": "github"
} }
}, },
@ -329,7 +352,7 @@
"lanzaboote": "lanzaboote", "lanzaboote": "lanzaboote",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
"nvf": "nvf", "nixvim": "nixvim",
"secrets": "secrets", "secrets": "secrets",
"sops-nix": "sops-nix" "sops-nix": "sops-nix"
} }

View file

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

View file

@ -1,15 +1,18 @@
{ {
self,
pkgs, pkgs,
lib, lib,
hostname, hostname,
user, user,
... ...
}: }:
with lib; with lib; {
{
# NixOS version. # NixOS version.
system.stateVersion = "25.05"; system.stateVersion = "25.05";
# Set $NIX_PATH to flake input.
nix.nixPath = ["nixpkgs=${self.inputs.nixpkgs}"];
# Enable flakes. # Enable flakes.
nix.settings.experimental-features = [ nix.settings.experimental-features = [
"nix-command" "nix-command"
@ -97,42 +100,129 @@ with lib;
# Install some packages. # Install some packages.
programs.git.enable = true; programs.git.enable = true;
programs.lazygit.enable = true;
programs.nvf = { programs.nixvim = {
enable = true; enable = true;
defaultEditor = true;
settings.vim = { globals.mapleader = " ";
autocomplete.blink-cmp.enable = true;
undoFile.enable = true;
lineNumberMode = "number";
options = rec { keymaps = [
shiftwidth = 2; {
tabstop = shiftwidth; key = "<Leader>t";
softtabstop = shiftwidth; action = "<cmd> ToggleTerm direction=float <CR>";
expandtab = true; 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; enable = true;
treesitter.enable = true; settings = {
lsp = { keymap.preset = "enter";
enable = true; menu.auto_show = true;
server = "nixd"; completion.documentation.auto_show = true;
};
format = {
enable = true;
type = "alejandra";
}; };
}; };
extraPlugins = { bufferline.enable = true;
kanagawa-nvim = { colorizer.enable = true;
package = pkgs.vimPlugins.kanagawa-nvim; gitsigns.enable = true;
setup = '' lsp-format.enable = true;
require("kanagawa").load("dragon") 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;
}; };
}; };
}; };