{"id":13611736,"url":"https://github.com/oxalica/nil","last_synced_at":"2025-05-14T13:08:18.626Z","repository":{"id":50716246,"uuid":"515507847","full_name":"oxalica/nil","owner":"oxalica","description":"NIx Language server, an incremental analysis assistant for writing in Nix.","archived":false,"fork":false,"pushed_at":"2025-03-04T20:07:25.000Z","size":1059,"stargazers_count":1527,"open_issues_count":39,"forks_count":46,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-07T08:49:50.758Z","etag":null,"topics":["lsp-server","nix","nixos","nixpkgs"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oxalica.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-07-19T08:55:08.000Z","updated_at":"2025-05-06T21:58:30.000Z","dependencies_parsed_at":"2024-01-29T07:28:03.306Z","dependency_job_id":"911d9caa-076e-4623-bf50-30523fae22f9","html_url":"https://github.com/oxalica/nil","commit_stats":{"total_commits":500,"total_committers":27,"mean_commits":18.51851851851852,"dds":0.07399999999999995,"last_synced_commit":"4f3081d1f10bb61f197b780e67f426e53f818691"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxalica%2Fnil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxalica%2Fnil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxalica%2Fnil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxalica%2Fnil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oxalica","download_url":"https://codeload.github.com/oxalica/nil/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254149960,"owners_count":22022851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lsp-server","nix","nixos","nixpkgs"],"created_at":"2024-08-01T19:02:03.369Z","updated_at":"2025-05-14T13:08:13.613Z","avatar_url":"https://github.com/oxalica.png","language":"Rust","funding_links":[],"categories":["Development","Rust","nix","Languages","others"],"sub_categories":["Discovery"],"readme":"# nil: Nix Language server\n\n[![CI](https://github.com/oxalica/nil/actions/workflows/ci.yaml/badge.svg)](https://github.com/oxalica/nil/actions/workflows/ci.yaml)\n\nAn incremental analysis assistant for writing in Nix.\n\nSee [release notes](https://github.com/oxalica/nil/releases) for changelog between releases.\n\nSee [`docs/features.md`](docs/features.md) for an incomplete list of notable features currently\nimplemented or planned.\n\nSee [`docs/configuration.md`](docs/configuration.md) for all tunable configuration options.\n\n## Installation\n\nThis program is available in [NixOS/nixpkgs](https://github.com/NixOS/nixpkgs) under attribute `nil`,\nand is regularly updated.\n\n- If you use `nix-env`, run `nix-env -iA nixpkgs.nil`\n- If you use `nix profile`, run `nix profile install nixpkgs#nil`\n- If you want to compile it from source:\n  1. Install stable Rust toolchain \u003e= 1.77\n  1. Install nix \u003e= 2.4 and make sure the binary `nix` is in your `PATH`.\n  1. Build and install via `cargo install --git https://github.com/oxalica/nil nil`\n\n## Install with [Flake](https://wiki.nixos.org/wiki/Flakes)\n\nThis repo is also packaged via Nix flakes. The language server package is\navailable in the default flake output `github:oxalica/nil#`, under `bin/nil`.\n\nTo install, run `nix profile install github:oxalica/nil`. Alternatively,\nyou can use this repository as a flake input, and add its output to your own flake-managed\nsystem-wide and/or home configurations.\n\n*Disclaimer: The `flake.lock` we ship is tested in CI. If you use `follows` to\noverride flake inputs, we do not guarantee that it will build.*\n\nFlake output structure (not necessarily up-to-date):\n```\n├───devShells\n│   └───(...)\n└───packages\n    ├───x86_64-linux\n    │   ├───default: package 'nil-unstable-2022-08-04'\n    │   └───nil: package 'nil-unstable-2022-08-04'\n    └───(...)\n```\n\n## Editor integration\n\n### Neovim native LSP and [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)\n\nWe are officially supported by nvim-lspconfig, see [upstream docs](https://github.com/neovim/nvim-lspconfig/blob/0fafc3ef648bd612757630097c96b725a36a0476/doc/server_configurations.txt#nil_ls),\nalso [the example config for testing](dev/nvim-lsp.nix).\n\n:warning: There is a known performance issue for semantic highlighting with\nneovim native LSP. See more details in https://github.com/oxalica/nil/issues/83\n\n### Vim/Neovim with [coc.nvim](https://github.com/neoclide/coc.nvim)\n\nMerge this setting into your `coc-settings.json` (open with `:CocConfig`).\n\n```jsonc\n{\n  \"languageserver\": {\n    \"nix\": {\n      \"command\": \"nil\",\n      \"filetypes\": [\"nix\"],\n      \"rootPatterns\":  [\"flake.nix\"],\n      // Uncomment these to tweak settings.\n      // \"settings\": {\n      //   \"nil\": {\n      //     \"formatting\": { \"command\": [\"nixfmt\"] }\n      //   }\n      // }\n    }\n  }\n}\n```\n\nSee [the example config for testing](dev/vim-coc.nix).\n\n### Vim with [vim-lsp](https://github.com/prabirshrestha/vim-lsp)\n\nAdd the following code to your `~/.vimrc` to register the LSP server.\nThanks @mitchmindtree\n\n```vim\nif executable('nil')\n  autocmd User lsp_setup call lsp#register_server({\n    \\ 'name': 'nil',\n    \\ 'cmd': {server_info-\u003e['nil']},\n    \\ 'whitelist': ['nix'],\n    \\ })\nendif\n```\n\n### Emacs with [lsp-mode](https://github.com/emacs-lsp/lsp-mode)\n\nAdd the following elisp code to your configuration. (using `use-package`)\n\n```elisp\n(use-package lsp-mode\n  :ensure t)\n\n(use-package lsp-nix\n  :ensure lsp-mode\n  :after (lsp-mode)\n  :demand t\n  :custom\n  (lsp-nix-nil-formatter [\"nixfmt\"]))\n\n(use-package nix-mode\n  :hook (nix-mode . lsp-deferred)\n  :ensure t)\n```\n\nThere are various other configurations to tweak. Refer to the\n[specific manual page](https://emacs-lsp.github.io/lsp-mode/page/lsp-nix-nil/) for more details.\n\n### Emacs with [eglot](https://github.com/joaotavora/eglot)\n\nAdd the following elisp code to your configuration. (using `use-package`)\n\n```elisp\n(use-package nix-mode)\n(use-package eglot\n  :config\n  ;; Ensure `nil` is in your PATH.\n  (add-to-list 'eglot-server-programs '(nix-mode . (\"nil\")))\n  :hook\n  (nix-mode . eglot-ensure))\n```\n\n### VSCode/VSCodium with [Nix IDE](https://github.com/nix-community/vscode-nix-ide)\n\nModify the extension's settings in your `settings.json`.\n\n```jsonc\n{\n  \"nix.enableLanguageServer\": true, // Enable LSP.\n  \"nix.serverPath\": \"nil\" // The path to the LSP server executable.\n\n  // Uncomment these to tweak settings.\n  // \"nix.serverSettings\": {\n  //   \"nil\": {\n  //     \"formatting\": { \"command\": [\"nixfmt\"] }\n  //   }\n  // }\n}\n```\n\n### Kate with [LSP Client Plugin](https://docs.kde.org/stable5/en/kate/kate/kate-application-plugin-lspclient.html)\n\nAdd this to your \"User Server Settings\" in LSP Client configuration:\n\n```json\n{\n  \"servers\": {\n    \"nix\": {\n      \"command\": [\"nil\"],\n      \"url\": \"https://github.com/oxalica/nil\",\n      \"highlightingModeRegex\": \"^Nix$\"\n    }\n  }\n}\n```\n\n## License\n\n\"nil\" is primarily distributed under the terms of both the MIT\nlicense and the Apache License (Version 2.0).\n\nSee LICENSE-APACHE and LICENSE-MIT for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxalica%2Fnil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foxalica%2Fnil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxalica%2Fnil/lists"}