NixOS with Hyprland. Config Hyprland with Lua.
- Lua 96.8%
- Nix 3.2%
| foot | ||
| hypr | ||
| .gitignore | ||
| configuration.nix | ||
| flake.lock | ||
| flake.nix | ||
| readme.org | ||
hyprlua-btw
Configuring Hyprland with Lua instead of Hyprlang.
Why Lua?
Hyprland has historically been configured in Hyprlang, a custom DSL. Vaxry added Lua as an alternative because the project has outgrown the DSL.
Lua is a good fit:
- tiny and embeddable
- on basically every system
- ubiquitous tooling (syntax highlighting, LuaLS)
- you get a real LSP — completions, diagnostics, go-to-def — on your config
Install on NixOS
Add Hyprland as a flake input:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
hyprland.url = "github:hyprwm/Hyprland/v0.55.0";
};
}
In configuration.nix:
programs.hyprland = {
enable = true;
xwayland.enable = true;
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland;
};
Install lua-language-server in your user packages so the LSP works.
Lua config + LSP
Delete ~/.config/hypr/hyprland.conf. Grab the Hyprland repo to pull the example Lua config and the LuaLS definitions:
git clone --depth=1 https://github.com/hyprwm/Hyprland
cd Hyprland
nix develop
# generate the LuaLS type definitions
cd meta && python <gen-script>
# move generated defs + example config into ~/.config/hypr
Then drop a .luarc.json in ~/.config/hypr so LuaLS picks up the hl global and the type definitions:
{
"workspace": {
"library": ["/home/tony/.config/hypr"]
},
"diagnostics": {
"globals": ["hl"]
}
}
Now you get full autocomplete and inline docs on every Hyprland keyword as you edit hyprland.lua.