Jump to content

Niri

From NixOS Wiki
Revision as of 07:11, 11 July 2025 by Zimward (talk | contribs) (The gnome desktop portal does get installed by the nixos module already. installing them into system/user path was never correct to begin with too.)

Niri is a scrollable-tiling Wayland compositor.

Installation

Simply enable programs.niri:

❄︎ /etc/nixos/configuration.nix
programs.niri.enable = true;
Note: Niri can be enabled without installing a custom flake such as niri-flake. niri-flake is only necessary if you want to use a very recent version of Niri or if you want to write configurations in the Nix language, although as of 2025 this repository is listed near the top in search engines.
⚠︎
Warning: Without #Configuration or #Additional Setup, or in other words after fresh installation, you may unable to launch apps because of missing Alacricity and fuzzel. Press Super + Shift + E to exit Niri and proceed to one of them.

Configuration

The configuration path for Niri is $XDG_CONFIG_HOME/niri/config.kdl. Therefore Home Manager can be used for configuration:

❄︎ ~/.config/home-manager/home.nix
xdg.configFile."niri/config.kdl".source = ./config.kdl;

You might want to start from the default configuration file described at [1].

See the wiki for configuration options for Niri.

Additional Setup

As described in Example systemd Setup (Niri wiki), you might want to set up some additional services including Swayidle, Swaylock, Waybar, Polkit and Secret Service as follows to complement the functionality of a regular window manager. Some of the these settings are also required to enable all the features of the default configuration file.

❄︎ ~/.config/home-manager/home.nix
programs.alacritty.enable = true; # Super+T in the default setting (terminal)
programs.fuzzel.enable = true; # Super+D in the default setting (app launcher)
programs.swaylock.enable = true; # Super+Alt+L in the default setting (screen locker)
programs.waybar.enable = true; # launch on startup in the default setting (bar)
services.mako.enable = true; # notification daemon
services.swayidle.enable = true; # idle management daemon
services.polkit-gnome.enable = true; # polkit
home.packages = with pkgs; [
  swaybg # wallpaper
];
❄︎ /etc/nixos/configuration.nix
security.polkit.enable = true; # polkit
services.gnome.gnome-keyring.enable = true; # secret service
security.pam.services.swaylock = {};

See Also