Nix modules based on
ycm-core/lsp-examples
- β¬οΈ Top of Document
- ποΈ Requirements
- β‘ Quick Start
- π§° Usage
- π Contributing
- βοΈ Status of LSP testing
- π Attribution
- βοΈ Licensing
Install the NixOS and/or Nix package manager via official instructions;
https://nixos.org/nixos/manual/
This repository requires the Vim text editor to be installed the
source code is available on GitHub -- vim/vim, and most GNU
Linux package managers are able to install Vim directly, eg...
- Arch based Operating Systems
sudo packman -Syy sudo packman -S vim
- Debian derived Distributions
sudo apt-get update sudo apt-get install vim
- Clone this project...
mkdir -vp ~/git/hub/nix-utilities
cd ~/git/hub/nix-utilities
git clone [email protected]:nix-utilities/ycm_examples.gitPass system level pkgs through Home-Manager extraSpecialArgs
flake.nix (snippet)
{
description = "System wide flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, home-manager, nixpkgs, ... }@attrs:
let
hostname = "nixos";
system = "x86_64-linux";
in
{
nixosConfigurations."${hostname}" = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = attrs;
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = with attrs; {
inherit nixpkgs;
pkgs = nixpkgs.legacyPackages.${system};
};
}
];
};
};
}
configuration.nix(snippet)
{
config,
lib,
nixpkgs,
pkgs,
...
}:
{
imports = [
(import /home/your-name/git/hub/nix-utilities/ycm_examples {
inherit config lib pkgs;
})
];
config.services.ycm_examples.servers = with config.services.ycm_examples; [
nil
pest-ide-tools
vim-language-server
# ...
];
}Then rebuild as usual;
sudo nixos-rebuild switch... note if using a flake.nix then instead of above, then use following;
nixos-rebuild switch --flake .flake.nix (diff)
{
description = "System wide flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
+ ycm_examples.url = "github:nix-utilities/ycm_examples?ref=main";
};
outputs = { self, home-manager, nixpkgs, ... }@attrs:
let
hostname = "nixos";
system = "x86_64-linux";
in
{
nixosConfigurations."${hostname}" = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = attrs;
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = with attrs; {
- inherit nixpkgs;
+ inherit nixpkgs ycm_examples;
pkgs = nixpkgs.legacyPackages.${system};
};
}
];
};
};
}
configuration.nix(diff)
{
config,
lib,
nixpkgs,
pkgs,
+ ycm_examples
...
}:
{
imports = [
- (import /home/your-name/git/hub/nix-utilities/ycm_examples {
+ (import ycm_examples {
inherit config lib pkgs;
})
];
config.services.ycm_examples.servers = with config.services.ycm_examples; [
nil
pest-ide-tools
vim-language-server
# ...
];
}Options for contributing to ycm_examples and nix-utilities
Start making a Fork of this repository to an account that you have write permissions for.
- Clone this project...
mkdir -vp ~/git/hub/nix-utilities
cd ~/git/hub/nix-utilities
git clone [email protected]:nix-utilities/ycm_examples.git- Add remote for fork URL. The URL syntax is
[email protected]:<NAME>/<REPO>.git...
cd ~/git/hub/nix-utilities/ycm_examples
git remote add fork [email protected]:<NAME>/ycm_examples.git- Add a language server sub-directory, for example here's how Astro support was added
mkdir my-language-server
touch astro-language-server/default.nix- Populate
astro-language-server/default.nixfile with configurations
{
config,
lib,
pkgs,
...
}:
let
utils = import ../utils.nix { inherit lib pkgs; };
in
utils.mkModule rec {
inherit config pkgs;
name = "astro-language-server";
lspConfig = {
ycm-lsp-server = {
name = "astro";
filetypes = [ "astro" ];
cmdline = [ "${pkgs.astro-language-server}/bin/astro-ls" "--stdio" ];
project_root_files = [ "tsconfig.json" "astro.config.mjs" ];
};
ycm_extra_conf.settings =
let
dict = utils.convertTo.python.dictFromAttrs {
ls.typescript.tsdk = "${pkgs.typescript.outPath}/lib/node_modules/typescript/lib";
};
in
''
if kwargs[ 'language' ] == 'astro':
return ${dict}
'';
};
}Notes about configurations;
lspConfig.ycm-lsp-serverattribute set will be appended to VimRC file'sg:ycm_language_serverlist value, check;
ycm-core/lsp-examples-- Configuration for additional details and valid values.:help g:ycm_language_serverfor Vim documentation
lspConfig.ycm_extra_conf.settingswill be inserted within the resultingSettingsfunction definition, and file path will appended to VimRC file'sg:ycm_global_ycm_extra_confvalue, check;
ycm-core/ycmd--examples/.ycm_extra_conf.pyfor examples:help g:ycm_global_ycm_extra_conffor Vim documentationWarnings
lspConfig.ycm-lsp-server.nameMUST match the value that Vim reports via:echo &filetypein order for YouCompleteMe to load correct settings fromycm_extra_conf.py
- Add to the
importslist withindefault.nix
{
imports = [
+ ./astro-language-server
./awk-language-server
./bash-language-server- Add entry to your
configuration.nix
{ config, pkgs, nixpkgs, ... }:
{
imports = [
(import /home/your-name/git/hub/nix-utilities/ycm_examples {
inherit config lib pkgs;
})
];
config.services.ycm_examples.servers = with config.services.ycm_examples; [
+ ./astro-language-server
nil
pest-ide-tools
vim-language-server
# ...
];
}-
Rebuild and test that things work
-
Commit your changes and push to your fork, eg. to fix an issue...
cd ~/git/hub/nix-utilities/ycm_examples
git commit -m "astro-language-server: Add language server"
git push fork mainNote, the
-uoption may be used to setforkas the default remote, eg.git push -u fork mainhowever, this will also default theforkremote for pulling from too! Meaning that pulling updates fromoriginmust be done explicitly, eg.git pull origin main
- Then on GitHub submit a Pull Request through the Web-UI, the URL syntax is
https://github.com/<NAME>/<REPO>/pull/new/<BRANCH>
Note; to decrease the chances of your Pull Request needing modifications before being accepted, please check the dot-github repository for detailed contributing guidelines.
Thanks for even considering it!
Via Liberapay you may
on a
repeating basis.
Regardless of if you're able to financially support projects such as ycm_examples that nix-utilities maintains, please consider sharing projects that are useful with others, because one of the goals of maintaining Open Source repositories is to provide value to the community.
./astro-language-serverworks withycm_extra_conf.pygenerated by./default.nix./awk-language-servererror,"POST /run_completer_command HTTP/1.1" 500./bash-language-serverworks./docker-language-serverworks mostly, provides basic syntax checking./dockerfile-language-server-nodejsworks, and providesGetHoverdocs too, unlike./docker-language-server./erlang-lsworks./haskell-language-servererror, may need investigation by Haskell expert./nilworks though may slow-down initial load./pestworks./postgres-lsperror, might need Docker or other dependencies injected, and checking the configuration documentation maybe wise./typescript-language-serverworks not to be confused withtsserverbundled withycmdwhich does not seem to work as of 2025-10-31./vim-language-serverworks./vscode-css-languageserverworks./vscode-json-languageserverno errors or server rejections but doesn't seem to do anything
- GitHub --
github-utilities/make-readme - Home Manager -- Writing Modules
- NixOS Manual -- Writing Modules
- NixOS Wiki -- NixOS Modules
Nix modules based on `ycm-core/lsp-examples` from GitHub
Copyright 2025 S0AndS0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For further details review full length version of Apache-2.0 License.