Skip to content

Better in-editor Nix support: nixd (eval + jump-to-source + option completion), live-eval loop, fuzzy doc search #39

Description

@gignsky

Goal (user's words): the equivalent of bacon for Rust but for Nix — a running "compiler" that evaluates and jumps to source in real time without leaving the editor, plus fuzzy find for variables and their documentation. Current best tool is standalone nix run github:bluskript/nix-inspect.

Researched state of the art (2025–2026). Summary + prioritized plan:

The core: nixd over nil

nixd links against real Nix libexpr, so it actually evaluates: real evaluation-error diagnostics, cross-file go-to-definition that jumps into nixpkgs source, and evaluation-driven completion including NixOS/Home-Manager option completion. nil is lighter/zero-config but static-only. For "evaluate + jump to source in real time," nixd is the pick.

The load-bearing config is pointing nixd at the flake:

"nixd": {
  "nixpkgs": { "expr": "import (builtins.getFlake (builtins.toString ./.)).inputs.nixpkgs { }" },
  "options": {
    "nixos":        { "expr": "(builtins.getFlake (builtins.toString ./.)).nixosConfigurations.ganoslal.options" },
    "home_manager": { "expr": "(builtins.getFlake (builtins.toString ./.)).homeConfigurations.\"gig@ganoslal\".options" }
  },
  "formatting": { "command": ["nixfmt"] }
}

Use builtins.toString ./. so it follows the opened project; test each expr in nix repl first; expect a first-call stall (lazy eval) and a broken flake.nix to silently disable option completion.

The "bacon for Nix" loop (honest: no dedicated tool exists)

  • nixd diagnostics are already a partial running-compiler (live errors).
  • For live values: a watchexec -e nix -- nix eval .#… --json (or a bacon custom job) in a toggleterm split. No mature Neovim plugin evaluates an expression under the cursor and shows the value inline — this is the one genuine gap.

Fuzzy variables + docs

  • manix wrapped in a Telescope picker (nixpkgs functions + NixOS and HM options + builtins) — highest-leverage single addition.
  • noogle for function search by name/type signature.
  • Telescope LSP pickers (lsp_dynamic_workspace_symbols, lsp_document_symbols, definitions/references) on top of nixd.
  • Keep nix-inspect as a bound TUI companion (<leader>ni), no editor integration expected.

Prioritized checklist

  • P0 Enable nixd as the Nix LSP (nixvim plugins.lsp.servers.nixd); disable/relegate nil.
  • P1 toggleterm + keymap for a watchexec/bacon nix eval watch split (live values).
  • P1 Telescope LSP symbol pickers for fuzzy variable navigation.
  • P1 manix Telescope picker for option/function doc search (<leader>fn).
  • P0 Formatter = nixfmt-rfc-style to match dotfiles pre-commit.
  • P2 Bind nix-inspect to open in a terminal split; noogle shortcut; optional nix-doc ctags fallback.
  • P0 Configure the three flake exprs (nixpkgs, options.nixos, options.home_manager) per above.

Sources: nix-community/nixd (docs/configuration.md), oxalica/nil, mlvzk/manix, noogle.dev, lf-/nix-doc, Canop/bacon, bluskript/nix-inspect, NixOS/nix-eval-jobs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions