How to install Niri?

Hello everyone!

I’ve been diving down this rabbit hole of customizing my setup, and so far, it’s been an incredible journey. The instructions have been surprisingly clear for a newcomer like me, and I’ve managed to troubleshoot any issues without irreversible setbacks.

My current installation uses GNOME (flakes + hm), which has served me well, but over time it’s grown bloated and cluttered. That said, I think I’ve discovered my ideal setup through a GNOME extension called PaperWM.

While researching further, I stumbled upon niri, a Rust-native window manager (GitHub link), which seems perfect for my needs. Unfortunately, installing it on NixOS proved overly confusing. I followed the official repository’s documentation across multiple pages but couldn’t get it working. In contrast, installing it on Fedora via COPR was remarkably straightforward—a few simple commands and it ran flawlessly.

After failing with the instructions, I checked the NixOS manual for guidance but found no helpful entries. Eventually, I discovered an intriguing setup by Kiara (NixOS wiki link). However, configuring it felt daunting due to its reliance on advanced tools like Disco and secrets management—technologies I’m entirely unfamiliar with.

… Sigh! That’s a long wall of text.

What I need right now are clear instructions for setting up niri—just a super basic installation. Something a newb can follow.

I don’t mind a fresh install → niri desktop environment. Heck! even better with a clean foundation like that I can build up (adding flakes, home-manager, etc.).

I know the Linux community often values self-reliance, and I have tried—but I keep getting distracted like a kid in a candy store (as those links probably prove :sweat_smile:). A straightforward guide would save me from myself!

For reference, here are a couple of guides / things I’ve tried:


Edits: Grammar / spelling errors fix. No more edits after this.

Have you tried setting programs.niri.enable = true?

Sorry, looks like I didn’t reply to you directly.

Thanks for replying.

Amongst all the things I tried I remember adding it to the flake.nix file, kinda like this:

inputs
niri.url = “github:sodiboo/niri-flake”;
niri.inputs.nixpkgs.follows = “nixpkgs”;
outputs (niri, …)
iri.nixosModules.niri

I also remember doing something like a new niri.nix file with “programs.niri.enable = true”. Not 100% sure, it’s been a while and I deleted that file. I tried installing Kiara’s setup and well… I had to re-install and go back to my own setup.

I don’t exactly know what you mean tho…

Did you mean install fresh + on the configuration.nix add “programs.niri.enable = true” and I’m guessing disable gnome? is that all?

Yes. Niri has been packaged for NixOS, so you’re overcomplicating it: programs.niri.enable.

The instructions from their repository are for if you want the latest of the latest version, ignoring software releases and just straight building whatever is on main. You can do that, but especially for a newbie I’d recommend just using what NixOS has packaged - it’s properly integrated and tested, so there are fewer issues to fall for. Plus, you won’t need to really use flakes, which can be confusing for a newcomer.

You likely don’t even need a reinstall if you just remove what changes you made to install niri so far from your configuration, and if you use a display manager you can have both desktop environments installed and just switch between them with the display manager. gdm should be configured to do that correctly if you use the NixOS options for everything.

2 Likes

:dizzy_face: there’s no way this works… lol I’m gonna try this out.

file: niri.nix

{ config, pkgs, lib, … }:

{
programs.niri = {
enable = true;
};
}

Will update if it works.

1 Like

@TLATER and @RossComputerGuy THANK YOU!

THANK YOU! It looks like it worked! I managed to get into the niri WM. While I couldn’t do much due to missing packages like fuzzel, alacritty, and others, it’s still progress! :blush:

Next, I’ll attempt a fresh NixOS install → console-only (no desktop environment) and use A.I. to fill knowledge gaps. Feel free to throw me a bone with some tips. My goal is to create the most bare-bones NixOS + niri setup possible. Might even experiment with disko – Kiara’s setup looked particularly clean from what I saw.

From what I understand so far, the essential components appear to be:

  • mako
    
  • gnome-keyring
    
  • xdg-desktop-portal-gtk
    
  • xdg-desktop-portal-gnome
    
  • fuzzel
    
  • kdePackages.polkit-kde-agent-1
    
  • xwayland-satellite
    
  • alacritty
    

Plus the basic addition of “programs.niri.enable = true;” to the configuration.nix file.

I’m excited! I’ll try to contain my excitement before I nuke this desktop and read your replies xD

1 Like

A bunch of that stuff is already configured for you: nixpkgs/nixos/modules/programs/wayland/niri.nix at 1d3aeb5a193b9ff13f63f4d9cc169fb88129f860 · NixOS/nixpkgs · GitHub

I’m also unsure if the kde polkit agent makes sense when you have gnome-keyring setup?

1 Like

I’m also unsure if the kde polkit agent makes sense when you have gnome-keyring setup?

Honestly, idk. I was just taking a look at the niri github (Important Software · YaLTeR/niri Wiki · GitHub). I don’t fault them. It must be hard to code, debug, write help files for newbs like me, and still keep fresh ideas flowing.

I figured it was something similar as having grub on nixos… you know… how you can’t completely remove systemd, because it’s always used somewhere even if you are actively using grub and you’ve deleted or selected the appropriate partitions. In my case, I stumbled upon that while dealing with hard drives. I had grub, I was using grub, and suddenly found myself using systemd stuff.

Sorry. I’m a complete noob. I try not to. I try tor read as much as I can, but I’m also using A.I., and I allowed A.I., to guide me through investigating if they were remnants of systemd still being used and we did find some. Kinda impossible to explain, because I was being guided.

I figured the same happens with niri? maybe some stuff from gnome and kde are always used?

Like… how will it look to install from scratch (no desktop environment) is it still programs.niri.enable = true? or there is much more that I will have to do? Idk… I figured I ask before formatting.

nixos is a systemd based distribution, systemd runs as pid 1 - you cannot run nixos without systemd

this is entirely unrelated to grub, niri, gnome, or kde

i think your AI can probably do a good job of explaining to you the category these software fall under and compare their usage to better understand the situation

You may be confusing systemd and systemd-boot. Very different things :slight_smile:

Contrast the two projects’ own descriptions:

They share a domain and name because they’re part of the same family of tools, and are maintained by the same group of people, but they’re not the same. Kinda like the cp and echo terminal utilities from the GNU coreutils.

Besides asking AI, looking at project pages and documentation is often quite enlightening. They describe things in the upstream’s words and don’t have your pre-existing confusion and bias flowing into a language model that then repeats parts of it to you.

It’s also not littered with the internet’s misguided obsession with “minimalism” that leads folks to try and remove systemd from systems without actually understanding what it is or that it isn’t just one massive piece of software, but lots of smaller projects that just work really well together… grub is “more bloated” than systemd-boot, for example - systemd-boot’s entire point is being a tiny tool because most of what grub does isn’t needed anymore in the UEFI world. Or look at NetworkManager vs systemd-networkd, you’d think the minimalism-or-bust guys would be all over the latter.

I was wondering why so many people use grub in their NixOS config, confusing it for disabling systemd makes a lot more (less?) sense than people really wanting poorly rendered background images behind their generation selection.


That said, installing a polkit agent makes sense, I was just under the impression that gnome-keyring included one. This may well be false; I have personally not used much software that uses polkit, and use keepass for my secret service.

NixOS doesn’t enable polkit by default anyway, so you may need to dig into the hidden assumptions in that wiki and figure out what all the software does and actually map it to the underlying services you need to enable on NixOS.

It’s a decent enough list for a “build your own DE” guide, though, you should not need much more. I’ve personally apparently been running stuff without polkit for half a decade :smiley:

You’ll discover the things you consider missing as you go; It doesn’t need to be perfect from day 1.

4 Likes

Is the niri flake/overlay still worth using? The installation was straightforward and I never had any issues with it (I had no prior experience with either Niri nor Wayland in general). I set it to install niri-stable.

If you want the stable release, you might as well use niri from Nixpkgs. Updates just take a little longer. The flake isn’t necessary for using niri and might just be adding extra eval time for no additional benefit. Consider the flake only if any of the following reasons appeal to you:

  • You want the stable releases of niri and (optionally) xwayland-satellite, but don’t want to wait till they are available in Nixpkgs, nor do you want to build from source.
  • You want the unstable (i.e. built against main branch) releases of niri and (optionally) xwayland-satellite, but don’t want to build from source.
  • You want to configure niri using Home Manager.

If you don’t care about any of these, programs.niri.enable = true; in your NixOS config should be enough. Then you can remove the niri flake input as well as the overlay.

1 Like

Additionally, when using the flake you have these downsides:

  • If you use .follows, changes to nixpkgs can break the niri build at any time
  • if you do not use .follows, you end up with a second copy of pretty much all base libraries, which increases your system closure size a lot
  • If you do not use .follows, you don’t benefit from nixpkgs maintenance for any of niri’s dependencies, and have to hope that upstream update their flake inputs regularly (spoiler: they do not)
  • You need to add another binary cache, which increases the number of things that can go wrong in terms of supply chain security.

There’s probably more. Really, once something is in nixpkgs you need to a have a good reason to use a third-party flake IMO. Just wanting slightly newer versions isn’t such a good reason, just .override the package version instead of swapping out the maintainership.

The flake you linked to is mainly for dev purposes (I’ll still inquire about the lack of updates). The flake that Nix(OS) users actually use is here: GitHub - sodiboo/niri-flake: Nix packages and modules for niri. The inputs of this flake are updated hourly[1]. But I do agree that there’s no reason to use the third-party flake if only the stable release is required.


  1. niri-flake/.github/workflows/update.yml at b483ca0ed4299199d944824768b0880437aaac03 · sodiboo/niri-flake · GitHub ↩︎

Fair enough, I was linking to the repository @goldminebanker linked to, which presumably is the one they were using.

In their defense, that is the official upstream, so while I appreciate that downstream nix users are much better at writing hygienic flakes, the general issue with flakes still holds.

But yeah, credit where credit is due, that project looks well-managed, it even considers the recursive dependency problem.

1 Like