Skip to content

nix-community/vscode-nix-ide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b8c6cc4 Β· Feb 2, 2025
Feb 2, 2025
Jan 26, 2025
Jan 17, 2025
Aug 16, 2020
Jan 26, 2025
Feb 2, 2025
Aug 20, 2021
Aug 15, 2022
Jan 17, 2025
Jan 17, 2025
Jan 24, 2025
Feb 2, 2025
Jan 2, 2025
Jul 12, 2020
Jan 26, 2025
Jan 2, 2025
Jan 24, 2025
Oct 19, 2020
Dec 10, 2021
Jan 16, 2025
Feb 2, 2025
Jan 2, 2025
Jul 26, 2023
Aug 20, 2021

Repository files navigation

Nix IDE βœ¨πŸ’‘πŸŒŸ

Adds Nix language support for Visual Studio Code.

Installation πŸ”¨

Available on both the Visual Studio Marketplace and the Open VSX Registry.

You can also open the Command Palette (Ctrl+Shift+P on Windows/Linux or Cmd+Shift+P on macOS) and enter ext install jnoortheen.nix-ide to install the extension, or download it from the latest release.

Quickstart πŸš€

  1. Install the extension, and Open a Nix file
  2. Syntax highlighting should work out of the box.
  3. Formatting the code should work if nixfmt (or the archived nixpkgs-fmt) is installed and available on the $PATH.
  4. Full language support is available if you have a language server installed and enabled. See LSP Plugin Support for more information.

Features 🎯

  • Syntax Highlighting support. Also Nix code blocks inside markdown files also highlighted.
  • The basic language integration is supported out of the box using nixfmt and nix-instantiate. Syntax Errors are linted using nix-instantiate while Auto-Formatting is handled by nixfmt by default. Custom formatter can be set by setting nix.formatterPath.
  • The full language support is enabled by configuring an LSP server.
  • Snippets are provided for conditional expressions, let expressions, with expressions, and recursive sets.
  • Path completion support using PathIntellisense extension

Settings βš™οΈ

Custom Formatter

It can be changed by setting nix.formatterPath to any command which can accept file contents on stdin and return formatted text on stdout.

{
    "nix.formatterPath": "nixfmt" // or "nixpkgs-fmt" or "alejandra" or "nix3-fmt" or pass full list of args such as  or `["treefmt", "--stdin", "{file}"]`
}

LSP Plugin Support

Full language support can be enabled by using a language server. Generally, any Nix LSP implementation should work.

{
  "nix.enableLanguageServer": true,
  "nix.serverPath": "nil", // or "nixd"
  // Pass settings to the language server via the `serverSettings` option.
  "nix.serverSettings": { ... }
}

Some examples of advanced settings are provided below for nil and nixd.

Contributing πŸ’ͺ

We welcome contributions to this extension. Kindly start with any of open issues or feature requests.

See CONTRIBUTING.md for more information.

Credits

Special thanks to: