Skip to content

Commit

Permalink
nixos/niri: init module
Browse files Browse the repository at this point in the history
  • Loading branch information
getchoo committed Oct 19, 2024
1 parent 4ad6e6f commit af8f1cf
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2411.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@

- [Flood](https://flood.js.org/), a beautiful WebUI for various torrent clients. Available as [services.flood](options.html#opt-services.flood).

- [Niri](https://github.com/YaLTeR/niri), a scrollable-tiling Wayland compositor. Available as [programs.niri](options.html#opt-programs.niri.enable).

- [Firefly-iii Data Importer](https://github.com/firefly-iii/data-importer), a data importer for Firefly-III. Available as [services.firefly-iii-data-importer](options.html#opt-services.firefly-iii-data-importer)

- [QGroundControl], a ground station support and configuration manager for the PX4 and APM Flight Stacks. Available as [programs.qgroundcontrol](options.html#opt-programs.qgroundcontrol.enable).
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
./programs/wayland/hyprland.nix
./programs/wayland/labwc.nix
./programs/wayland/miracle-wm.nix
./programs/wayland/niri.nix
./programs/wayland/river.nix
./programs/wayland/sway.nix
./programs/wayland/uwsm.nix
Expand Down
76 changes: 76 additions & 0 deletions nixos/modules/programs/wayland/niri.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
config,
lib,
pkgs,
...
}:

let
cfg = config.programs.niri;
in
{
options.programs.niri = {
enable = lib.mkEnableOption "Niri, a scrollable-tiling Wayland compositor";

package = lib.mkPackageOption pkgs "niri" { };

# Recommended by upstream
# https://github.com/YaLTeR/niri/wiki/Important-Software#authentication-agent
polkitAgent.enable = lib.mkEnableOption "a PolicyKit agent service" // {
default = config.security.polkit.enable;
defaultText = "config.security.polkit.enable";
};

# Recommended by upstream
# https://github.com/YaLTeR/niri/wiki/Important-Software#portals
portalPackage = lib.mkPackageOption pkgs "xdg-desktop-portal-gnome" {
# https://github.com/NixOS/nixpkgs/pull/348193#discussion_r1798515394
extraDescription = "Note: `xdg-desktop-portal-gnome` is required for screencast support";
};
};

config = lib.mkIf cfg.enable (
lib.mkMerge [
{
environment.systemPackages = [ cfg.package ];

services = {
displayManager.sessionPackages = [ cfg.package ];

# Recommended by upstream
# https://github.com/YaLTeR/niri/wiki/Important-Software#portals
gnome.gnome-keyring.enable = lib.mkDefault true;
};

systemd.packages = [ cfg.package ];

xdg.portal = {
enable = lib.mkDefault true;

configPackages = [ cfg.package ];
extraPortals = [ cfg.portalPackage ];
};
}

(lib.mkIf cfg.polkitAgent.enable {
systemd = {
packages = [ pkgs.libsForQt5.polkit-kde-agent ];
user.services.plasma-polkit-agent = {
wantedBy = [ "niri.service" ];
};
};
})

(import ./wayland-session.nix {
inherit lib pkgs;
enableWlrPortal = false;
enableXWayland = false;
})
]
);

meta.maintainers = with lib.maintainers; [
getchoo
sodiboo
];
}

0 comments on commit af8f1cf

Please sign in to comment.