1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7let
8 cfg = config.programs.niri;
9in
10{
11 options.programs.niri = {
12 enable = lib.mkEnableOption "Niri, a scrollable-tiling Wayland compositor";
13
14 package = lib.mkPackageOption pkgs "niri" { };
15 };
16
17 config = lib.mkIf cfg.enable (
18 lib.mkMerge [
19 {
20 environment.systemPackages = [ cfg.package ];
21
22 services = {
23 displayManager.sessionPackages = [ cfg.package ];
24
25 # Recommended by upstream
26 # https://github.com/YaLTeR/niri/wiki/Important-Software#portals
27 gnome.gnome-keyring.enable = lib.mkDefault true;
28 };
29
30 systemd.packages = [ cfg.package ];
31
32 xdg.portal = {
33 enable = lib.mkDefault true;
34
35 configPackages = [ cfg.package ];
36
37 # Recommended by upstream, required for screencast support
38 # https://github.com/YaLTeR/niri/wiki/Important-Software#portals
39 extraPortals = [ pkgs.xdg-desktop-portal-gnome ];
40 };
41 }
42
43 (import ./wayland-session.nix {
44 inherit lib pkgs;
45 enableWlrPortal = false;
46 enableXWayland = false;
47 })
48 ]
49 );
50
51 meta.maintainers = with lib.maintainers; [
52 getchoo
53 sodiboo
54 ];
55}