oraios/serena · error · RuntimeError
Nix is required for nixd. Please install Nix from https://ni
Error message
Nix is required for nixd. Please install Nix from https://nixos.org/download.html
What it means
_get_or_install_core_dependency for nixd first requires the Nix package manager itself (checked via shutil.which("nix")), because nixd is installed through Nix when missing. If the `nix` binary is absent, RuntimeError is raised pointing to the Nix download page.
Source
Thrown at src/solidlsp/language_servers/nixd_ls.py:116
if result.returncode == 0:
nixd_path = shutil.which("nixd")
if nixd_path:
log.info("Successfully installed nixd at: %s", nixd_path)
return nixd_path
log.error("Failed to install nixd: %s", result.stderr)
except subprocess.TimeoutExpired:
log.error("Nix install timed out after 10 minutes")
except Exception:
log.exception("Error installing nixd with nix")
return None
def _get_or_install_core_dependency(self) -> str:
"""Return a working nixd path, installing nixd when necessary."""
if not shutil.which("nix"):
log.error("Nix is not installed. nixd requires Nix to function properly.")
raise RuntimeError("Nix is required for nixd. Please install Nix from https://nixos.org/download.html")
nixd_path = self._get_nixd_path()
if not nixd_path:
log.info("nixd not found. Attempting to install...")
nixd_path = self._install_nixd_with_nix()
if not nixd_path:
raise RuntimeError(
"nixd (Nix Language Server) is not installed.\n"
"Please install nixd using one of the following methods:\n"
" - Using Nix flakes: nix profile install github:nix-community/nixd\n"
" - From nixpkgs: nix-env -iA nixpkgs.nixd\n"
" - On macOS with Homebrew: brew install nixd\n\n"
"After installation, make sure 'nixd' is in your PATH."
)
try:
result = subprocess_run([nixd_path, "--version"], capture_output=True, text=True, check=False, timeout=5)View on GitHub (pinned to 7fcbca7e62)
Solutions
- Install Nix from https://nixos.org/download.html and restart the shell.
- Alternatively install the nixd binary directly (brew install nixd, nix profile install github:nix-community/nixd) so the Nix-based install path is skipped.
- Ensure the nix binary location (e.g. /nix/var/nix/profiles/default/bin) is on PATH in non-interactive shells/CI.
Defensive patterns
Strategy: validation
Validate before calling
import shutil
if not shutil.which("nix"):
raise SystemExit("Install Nix first: https://nixos.org/download.html") Try / catch
try:
server = NixdLanguageServer(...)
except RuntimeError as e:
if "Nix is required" in str(e):
install_nix() # or preinstall nixd binary
else:
raise Prevention
- Install Nix on all dev machines and CI images using nixd.
- Or preinstall the nixd binary (brew/nix profile) so Nix itself is not needed at install time.
- Ensure /nix/var/nix/profiles/default/bin is on PATH in non-interactive shells.
When it happens
Trigger: Initializing the nixd language server on a machine where `nix` is not on PATH and nixd itself is not already installed (so the Nix-based installer path is taken).
Common situations: Developers on macOS/Windows/WSL without Nix; CI images without the Nix package manager; nix installed only in a user profile not on PATH.
Related errors
- nixd (Nix Language Server) is not installed. Please install
- Elixir is not installed. Please install Elixir from https://
- Erlang LS not found. Install from: https://github.com/erlang
- Erlang/OTP not found. Install from: https://www.erlang.org/d
- lean is not installed or not in PATH. Please install Lean 4
AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29).
Data as JSON: /api/errors/9ffda2f4951f7cd9.
Report an issue: GitHub.