Hyprland on NixOS
Hyprland on NixOS
The NixOS module enables critical components needed to run Hyprland properly, such as polkit, xdg-desktop-portal-hyprland, graphics drivers, fonts, dconf, xwayland, and adding a proper Desktop Entry to your Display Manager.
Make sure to check out the options of the NixOS module.
Warning
Required:
- NixOS Module: enables critical components needed to run Hyprland properly.
Without this, you may have issues with missing session files in your Display Manager.
Optional:
- Home Manager module: lets you configure Hyprland declaratively through Home Manager.
- Configures Hyprland and adds it to your user’s
$PATH, but does not make certain system-level changes such as adding a desktop session file for your display manager.
This is handled by the NixOS module, once you enable it.
configuration.nix
{
programs.hyprland.enable = true; # enable Hyprland
environment.systemPackages = [
# ... other packages
pkgs.kitty # required for the default Hyprland config
];
# Optional, hint Electron apps to use Wayland:
# environment.sessionVariables.NIXOS_OZONE_WL = "1";
}This will use the Hyprland version included in the Nixpkgs release you’re using.
Fixing problems with themes
If your themes for your mouse cursors, icons or windows don’t load correctly, see the relevant section in Hyprland on Home Manager.
If you prefer not to use Home Manager, you can also resolve the issues with GTK themes using dconf like so:
configuration.nix
{
programs.dconf.profiles.user.databases = [
{
settings."org/gnome/desktop/interface" = {
gtk-theme = "Adwaita";
icon-theme = "Flat-Remix-Red-Dark";
font-name = "Noto Sans Medium 11";
document-font-name = "Noto Sans Medium 11";
monospace-font-name = "Noto Sans Mono Medium 11";
};
}
];
}Upstream module
The upstream module provides options similar to the ones in the Home Manager module.
To use it, simply add
{inputs, ...}: {
imports = [inputs.hyprland.nixosModules.default];
programs.hyprland = {
# usual Nixpkgs module options
plugins = [
#...
];
settings = {
# ...
};
};
}Last updated on