cycle-1: drop nixvim — pureintent eval 10.87s → 6.98s (-36%)

nixvim's home-manager module system is by far the dominant cost of
evaluating `nixosConfigurations.pureintent`: a profile of selective
imports puts it at 3.97s of the 10.87s baseline (~36%).

Replace it with a minimal `programs.neovim.enable = true` configuration.
The runtime behaviour of `nvim` changes (no plugins, no LSP, no
mapleader/telescope/treesitter/etc.) — accepted by the user.

Measured on srid-nc (nixos, 6.12.85 kernel), 7 warm-cache runs with
`--option eval-cache false`:

  baseline: 10.85 10.86 10.86 10.87 10.87 10.88 10.91 -> median 10.87s
  cycle-1:  6.94  6.96  6.98  6.98  7.02  7.02  7.73 -> median 6.98s

Other configurations still evaluate:
  - nixosConfigurations.naiveintent
  - darwinConfigurations.infinitude-macos
  - homeConfigurations."srid@zest"

Removes flake input `nixvim` (+ its `flake-parts`, `nixpkgs`, `systems`
sub-inputs from the lock).
This commit is contained in:
Sridhar Ratnakumar 2026-05-15 13:01:10 -04:00
parent aebc9797a4
commit 304d8e7707
7 changed files with 40 additions and 212 deletions

View file

@ -76,13 +76,46 @@ Inputs declared in `flake.nix`:
`nixos-hardware`, `nixos-unified`, `nixos-vscode-server`, `nixpkgs`,
`nixvim`, `project-unknown`, `vira`, `zmx`.
Per-input blame is filled in as cycles run.
Per-input blame from Phase-1 probes (drop the module that imports the
input; everything else held constant; 3 runs each, eval-cache off):
| input / module | path | wall when dropped | Δ saved | share |
|---|---|---:|---:|---:|
| baseline | — | 10.87 | — | 100 % |
| `nixvim` | `modules/home/editors/neovim/` | 6.90 | **3.97** | **36.5 %** |
| `vira` | `modules/home/services/vira.nix` | 9.59 | 1.28 | 11.8 % |
| `jumphost-nix` | `modules/home/work/juspay.nix` | 8.16 (vira out, jumphost-nix import removed) | 1.43 | 13.1 % |
| `kolu` | `modules/home/services/kolu.nix` | 10.37 | 0.50 | 4.6 % |
| `agenix` (HM module) | `modules/home/agenix.nix` | ≈ 8.07 | ≈ 0 | < noise |
| `agenix` (NixOS module) | `modules/nixos/common.nix:agenix` | 10.82 | ≈ 0 | < noise |
| `programs.jumphost.*` body | `modules/home/work/juspay.nix` | 9.51 → 9.56 | 0.05 | < noise |
| `claude-code` | `modules/home/claude-code` | 11.01 | ≈ 0 | < noise |
| `buildMachines` | `modules/home/nix/buildMachines*` | 10.89 | ≈ 0 | < noise |
| `incus`, `beszel`, `firefox`, `ttyd` | various | ≈ 10.8510.92 | ≈ 0 | < noise |
Compound floors:
| drop | wall (s) | reduction |
|---|---:|---:|
| baseline | 10.87 | — |
| nixvim + vira + juspay + agenix (HM+NixOS) | 4.29 | 60.5 % |
| above + kolu | 3.85 | 64.6 % |
So the absolute lower bound (with these four heavies stubbed out) is
≈ 3.85 s — that's the cost of nixpkgs + home-manager + nixos-unified +
everything else combined.
The `home-manager.sharedModules` plumbing block in
`modules/nixos/common.nix` was probed independently: removing it left
the wall time unchanged (10.95 s ≈ 10.87 s), so the per-host HM-setup
boilerplate itself isn't a contributor.
## Optimization log
| # | hypothesis | mutation | wall (s) | Δ vs baseline | committed? | notes |
|---|---|---|---|---|---|---|
| 0 | — | baseline | 10.87 | — | — | reference |
| 1 | nixvim is 36 % of eval; the cost is the option system, not the resulting nvim binary | delete `inputs.nixvim` + the nixvim module; replace `modules/home/editors/neovim/` with a minimal `programs.neovim { enable; defaultEditor; vimAlias; viAlias; }` | **6.98** | **3.89 s (35.8 %)** | ✅ | 7-run median; range 7.736.94 (first-run warm-up jitter). Other configs (`naiveintent`, `infinitude-macos`, `srid@zest`) still eval cleanly. **Behaviour note:** nvim is now plain — none of the previous plugins (rose-pine, telescope, treesitter, lualine, noice, LSP keymaps, nvim-tree, lazygit, outline-nvim, mapleader) survive. User explicitly approved dropping nixvim. |
## Dead ends

63
flake.lock generated
View file

@ -423,27 +423,6 @@
}
},
"flake-parts_6": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1777988971,
"narHash": "sha256-qIoWPDs+0/8JecyYgE3gpKQxW/4bLW/gp45vow9ioCQ=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "0678d8986be1661af6bb555f3489f2fdfc31f6ff",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_7": {
"inputs": {
"nixpkgs-lib": [
"vira",
@ -466,7 +445,7 @@
},
"flake-utils": {
"inputs": {
"systems": "systems_5"
"systems": "systems_4"
},
"locked": {
"lastModified": 1731533236,
@ -1161,28 +1140,6 @@
"type": "github"
}
},
"nixvim": {
"inputs": {
"flake-parts": "flake-parts_6",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_4"
},
"locked": {
"lastModified": 1778510615,
"narHash": "sha256-cMNCx8mQTJnVkA6kt3B3ArGpCOOniYn644hH0mJHSsw=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "fa8cd368d27cf9541f086485884928315abdcc8c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"process-compose-flake": {
"locked": {
"lastModified": 1767863885,
@ -1270,7 +1227,6 @@
"nixos-unified": "nixos-unified_2",
"nixos-vscode-server": "nixos-vscode-server",
"nixpkgs": "nixpkgs_4",
"nixvim": "nixvim",
"project-unknown": "project-unknown",
"vira": "vira",
"zmx": "zmx"
@ -1397,21 +1353,6 @@
"type": "github"
}
},
"systems_5": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"tabler-icons-hs": {
"flake": false,
"locked": {
@ -1486,7 +1427,7 @@
"inputs": {
"co-log-effectful": "co-log-effectful",
"devour-flake": "devour-flake",
"flake-parts": "flake-parts_7",
"flake-parts": "flake-parts_6",
"fourmolu-nix": "fourmolu-nix_3",
"git-hooks": "git-hooks_5",
"haskell-flake": "haskell-flake_3",

View file

@ -46,10 +46,6 @@
llm-agents.url = "github:numtide/llm-agents.nix/d9583b68fdc553936b35dc6ca206d8d8dd552e5b";
llm-agents.inputs.nixpkgs.follows = "nixpkgs";
# Neovim
nixvim.url = "github:nix-community/nixvim";
nixvim.inputs.nixpkgs.follows = "nixpkgs";
# Emanote & Imako
emanote.url = "github:srid/emanote";
imako.url = "github:srid/imako";

View file

@ -16,7 +16,6 @@
"nix-darwin"
# "nixos-hardware"
"nix-index-database"
"nixvim"
];
};
};

View file

@ -1,127 +1,9 @@
{ flake, pkgs, ... }:
let
inherit (flake) inputs;
in
{ ... }:
{
imports = [
inputs.nixvim.homeModules.nixvim
];
programs.nixvim = {
programs.neovim = {
enable = true;
defaultEditor = true;
imports = [
./nvim-tree.nix
./lazygit.nix
];
# Theme
colorschemes.rose-pine.enable = true;
# Settings
opts = {
expandtab = true;
shiftwidth = 2;
smartindent = true;
tabstop = 2;
number = true;
clipboard = "unnamedplus";
termguicolors = true;
};
# Keymaps
globals = {
mapleader = " ";
};
extraPlugins = [
pkgs.vimPlugins.outline-nvim
];
plugins = {
# UI
web-devicons.enable = true;
lualine.enable = true;
bufferline.enable = true;
treesitter = {
enable = true;
};
haskell-scope-highlighting.enable = true;
which-key = {
enable = true;
};
noice = {
# WARNING: This is considered experimental feature, but provides nice UX
enable = true;
settings.presets = {
bottom_search = true;
command_palette = true;
long_message_to_split = true;
#inc_rename = false;
#lsp_doc_border = false;
};
};
telescope = {
enable = true;
keymaps = {
"<leader>ff" = {
options.desc = "file finder";
action = "find_files";
};
"<leader>fr" = {
options.desc = "recent files";
action = "oldfiles";
};
"<leader>fg" = {
options.desc = "find via grep";
action = "live_grep";
};
"<leader>T" = {
options.desc = "switch colorscheme";
action = "colorscheme";
};
};
extensions = {
file-browser.enable = true;
ui-select.enable = true;
frecency.enable = true;
fzf-native.enable = true;
};
};
# LSP
# https://github.com/nix-community/nixvim/blob/main/plugins/lsp/default.nix
lsp = {
enable = true;
keymaps = {
lspBuf = {
"gd" = "definition";
"gD" = "references";
"gt" = "type_definition";
"gi" = "implementation";
"K" = "hover";
"<leader>A" = "code_action";
};
diagnostic = {
"<leader>k" = "goto_prev";
"<leader>j" = "goto_next";
};
};
servers = {
hls = {
enable = true;
installGhc = false;
};
marksman.enable = true;
nil_ls.enable = true;
rust_analyzer = {
# enable = true;
installCargo = false;
installRustc = false;
};
};
};
};
vimAlias = true;
viAlias = true;
};
}

View file

@ -1,10 +0,0 @@
{
plugins.lazygit.enable = true;
keymaps = [
{
action = "<cmd>LazyGit<CR>";
key = "<leader>gg";
}
];
}

View file

@ -1,13 +0,0 @@
{
plugins.nvim-tree.enable = true;
keymaps = [
{
action = "<cmd>NvimTreeFindFileToggle<CR>";
key = "<leader>tt";
}
{
action = "<cmd>NvimTreeFindFile<CR>";
key = "<leader>tf";
}
];
}