Skip to content

Instantly share code, notes, and snippets.

@mausch
Created January 9, 2026 08:50
Show Gist options
  • Select an option

  • Save mausch/8f09a13602dfe1674173aa82e82b4dc5 to your computer and use it in GitHub Desktop.

Select an option

Save mausch/8f09a13602dfe1674173aa82e82b4dc5 to your computer and use it in GitHub Desktop.
csharp-ls
{
description = "csharp-ls language server";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/723a7b8c5ec99cb2275aadf2fd83f65d2c6dd6ec";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
perSystem = {
config,
self',
inputs',
pkgs,
system,
...
}: {
packages.default = pkgs.stdenv.mkDerivation {
pname = "csharp-ls";
version = "0.21.0";
src = pkgs.fetchurl {
url = "https://www.nuget.org/api/v2/package/csharp-ls/0.21.0";
sha256 = "sha256-XFzTJ7UWaFQEmFmdY/zY4zjKZaKK9aUq4Zbt3h+19bg=";
};
nativeBuildInputs = [pkgs.unzip];
unpackPhase = ''
unzip $src
'';
installPhase = ''
mkdir -p $out/lib/csharp-ls
cp -r * $out/lib/csharp-ls/
mkdir -p $out/bin
cat > $out/bin/csharp-ls <<EOF
#!/bin/sh
exec ${pkgs.dotnet-sdk_10}/bin/dotnet exec $out/lib/csharp-ls/tools/net10.0/any/CSharpLanguageServer.dll "\$@"
EOF
chmod +x $out/bin/csharp-ls
'';
meta = with pkgs.lib; {
description = "Roslyn-based LSP language server for C#";
homepage = "https://github.com/razzmatazz/csharp-language-server";
license = licenses.mit;
platforms = platforms.all;
};
};
apps.default = {
type = "app";
program = "${self'.packages.default}/bin/csharp-ls";
};
};
};
}
@mausch
Copy link
Author

mausch commented Jan 9, 2026

nix run --refresh --no-write-lock-file git+https://gist.github.com/mausch/8f09a13602dfe1674173aa82e82b4dc5.git

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