Declaratively configure Lite-XL languages, plugins, and libraries.
Nix-XL features automatic dependency resolution, which makes Lite-XL configuration as simple as possible for Nix users without the need for lpm.
This project is still fairly unfinished, see the TODO section for more information
Supports 100% of all included plugins and libraries in lite-xl-plugins and nearly all of the linked plugins and libraries.
Nix-XL also supports the plugin sets like LSP, languages, and formatters from lite-xl-plugins and Evergreen highlighters.
Note
Not all features currently have their hashes set or dependencies configured. If you discover one, open an issue
Nix-XL is currently only supported as a home-manager module. It will not work in a NixOS configuration.
The only architecture currently supported is x86_64-linux. Others may be supported in the future.
Add the flake to your inputs:
# flake.nix
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nix-xl.url = "github:passivelemon/nix-xl";
};
outputs = { ... } @ inputs: {
# ...
};
}Import the module and enable it:
# home.nix
{
imports = [
inputs.nix-xl.homeModules.nix-xl
];
programs.lite-xl = {
enable = true;
depRes = true;
};
}When a config module is enabled, it will add the specified plugins/libraries to your Lite-XL config directory (Usually ~/.config/lite-xl/). Additionally, each modules will create lua files that automatically load the specified plugins if required.
Disabling depRes (enabled by default) will disable automatic dependency resolution for the whole configuration.
To enable plugins, use the plugin option:
# home.nix
{
programs.lite-xl = {
enable = true;
plugins.enableList = [ "bracketmatch" "editorconfig" "gitdiff_highlight" "treeview-extender" ];
};
}- All available plugins are on the official plugin repository
ide_*plugins are not included since they are all links to the sameideplugin.
Plugins are placed top-level in ~/.config/lite-xl/plugins/ and do not require a loading init.lua file as Lite-XL will attempt to load all top-level plugins in this location.
To enable syntax highlighting for languages, use the language option:
# home.nix
{
programs.lite-xl = {
enable = true;
plugins.languages.enableList = [ "nix" "yaml" "zig" ];
};
}- All available languages are on the official plugin repository
The languages are placed in ~/.config/lite-xl/plugins/languages/ and a subsequent init.lua file is also placed there to load the languages.
LSP provides language server and linter support in the editor, enabling autocompletions, hover information, type checking, etc.
To enable it, use the option:
# home.nix
{
programs.lite-xl = {
enable = true;
plugins.lsp = {
enableList = [ "bashls" "sumneko_lua" ];
addPackages = true;
};
};
}- Supported LSPs can be found here
Enabling addPackages will add the appropriate language servers and linters (if lintplus is in the plugins enableList) to your home.packages.
When any item is added to enableList, the LSP plugin is automatically enabled. Currently there is no way to configure the LSPs.
The init.lua file to load the LSP configs is placed in ~/.config/lite-xl/plugins/lsp_servers
Lintplus provides linter support in the editor.
To enable it, use the option:
# home.nix
{
programs.lite-xl = {
enable = true;
plugins.lintplus = {
enableList = [ "luacheck" "python" ];
addPackages = true;
copyLanguages.enable = true;
};
};
}- Supported linters can be found here
Enabling addPackages will add the appropriate linters to your home.packages.
Enabling copyLanguages will attempt to enable each linter in your Lite-XL languages. Not all linters are named after their language (cppcheck, luacheck, shellcheck) so those have to be manually enabled.
When any item is added to enableList, the Lintplus plugin is automatically enabled. Currently there is no way to configure linters.
The init.lua file to load the linter configs is placed in ~/.config/lite-xl/plugins/lintplus_linters
Formatter provides formatting key bindings in the editor.
To enable it, use the option:
# home.nix
{
programs.lite-xl = {
enable = true;
plugins.formatter = {
enableList = [ "black" "luaformatter" ];
};
};
}- Supported formatters can be found here
When any item is added to enableList, the formatters plugin is automatically enabled.
The formatters are placed in ~/.config/lite-xl/plugins/formatters/ and a subsequent init.lua file is also placed there to load the formatters.
Evergreen adds support for syntax highlighting with Treesitter. This allows for more intelligent highlighting, but the number of available languages is far lesser than Lite-XL regex-style highlighting.
To enable it, use the option:
# home.nix
{
programs.lite-xl = {
enable = true;
plugins.evergreen = {
enableList = [ "html" "lua" ];
copyLanguages.enable = true;
};
};
}- Supported languages can be found here
Enabling copyLanguages will attempt to enable each Evergreen language in your Lite-XL languages.
When any item is added to enableList, the Evergreen plugin is automatically enabled.
The languages are placed in ~/.config/lite-xl/plugins/evergreen_languages/ and a subsequent init.lua file is also placed there to enable the language configs.
To enable libraries, use the library option:
# home.nix
{
programs.lite-xl = {
enable = true;
libraries.enableList = [ "font_symbols_nerdfont_mono_regular" "tree_sitter" "widget" ];
};
}- All available libraries are on the official plugin repository
Libraries are only used if a plugin or another library depends on them so they do not need any sort of init.lua file.
To enable fonts, use the font options:
# home.nix
{
programs.lite-xl = {
enable = true;
fonts = {
enable = true;
font = "FiraCodeNerdFont-Retina";
codeFont = "FiraCodeNerdFontMono-Retina";
};
};
}- Supported fonts can be found here
Currently, fonts are not automatically loaded so you will still need to configure that yourself. They are found at ~/.config/lite-xl/fonts.
Each module provides a way to configure custom plugins, libraries, languages, fonts, etc.
Any custom will override the same name item in the enableList. For example: if exterm were in enableList and also enabled with a custom source, only the source from the custom will be placed in your Lite-XL plugins.
Customs also skip dependency resolution since the names are not fixed. Technically, dependency resolution can work for customs, but only if they share a name with a supported plugin. For example: The nerdicons plugin depends on the font_symbols_nerdfont_mono_regular library. If you were to just use a custom nerdicons plugin, the library would not get loaded. However if you also specify nerdicons in the normal enableList, the library will get loaded, but the custom nerdicons source is still used.
For modules that take an enableList, use the customEnableList option. Despite the name, it should not be a list, rather it should be an attr set in the following format:
# home.nix
{
programs.lite-xl = {
enable = true;
plugins = {
enableList = [ /* ... */ ];
customEnableList = {
"exterm" = <path/to/exterm.lua>;
"nerdicons" = <path/to/nerdicons.lua>;
};
};
};
}- LSP and Linters are the only exception to this as those modules can't enable custom configs
Fonts specifically have custom prefixed options that override the normal config options:
# home.nix
{
programs.lite-xl = {
enable = true;
fonts = {
enable = true;
customFont = <path/to/font.ttf>;
};
};
}- Any extension is supported, but it needs to be supported by Lite-XL to actually work
Like with enableLists, the customFont will override the normal config option.
Main:
- Config
- Main init file
- Load fonts and theme color file
- Load extra config file for user specified lua configuration.
- Fonts
- Defined fonts
- Custom fonts
- Lua file to load fonts
- Font size config option
- Packages
- Build
nonicons - Finish
www
- Build
Other maybes:
- Figure out a better way to source versions than packing everything into one nvfetcher.toml. It just needs to avoid getting rate-limited
- Switch everything from fetchgit to fetchFromGitHub where applicable
- External generated documentation
- Specific plugin configuration, like for snippets
- Warnings for languages copied, but not used (because a linter name doesn't match)
- Custom linters and LSP server configuration
- LSP copyLanguages option. Some languages have multiple supported servers