Nix Flake: Language Servers

Packages included:

CLI tools (to be used with diagnostic-language-server):

Usage

With Flakes

Add this repo to your flake.nix inputs like:

{
  # ...
  inputs.lsp-nix.url = "github:thelonelyghost/lsp-nix";
  # ...

  outputs = { self, nixpkgs, flake-utils, lsp-nix, ...}@attrs:
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = import nixpkgs {
        inherit system;
      };
      lsp = lsp-nix.packages."${system}";
    in {
      devShell = pkgs.mkShell {
        nativeBuildInputs = [
          pkgs.bashInteractive
          lsp.dot-language-server
        ];
      };
    });
}

Updating: Anytime you want to update what lsp-nix offers, run nix flake lock --update-input lsp-nix and rebuild your nix expression acccordingly.

Without Flakes

If you're not yet using Nix Flakes, such as with home-manager, here's how you can include it:

  1. Install niv and run niv init
  2. Run niv add thelonelyghost/lsp-nix --name lsp-nix
  3. Include the following in your code:
{ lib, config, ... }:

let
  sources = import ./nix/sources.nix {};
  pkgs = import sources.nixpkgs {};

  lsp = (import (pkgs.fetchFromGitHub { inherit (sources.lsp-nix) owner repo rev sha256; })).outputs.packages."${builtins.currentSystem}";
in
{
  home.packages = [
    lsp.dot-language-server
  ];
}

Updating: Anytime you want to update what lsp-nix offers, run niv update lsp-nix and rebuild your nix expression acccordingly.