Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 31 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,16 @@
type = nixpkgs.lib.types.package;
default = (make-package-set pkgs).niri-stable;
};
withUWSM =
nixpkgs.lib.mkEnableOption null
// {
description = ''
Launch niri with the UWSM (Universal Wayland Session Manager) session manager.
::: {.note}
Requires extra configuration of greetd or from a display manager like SDDM
:::
'';
};
};

options.niri-flake.cache.enable = nixpkgs.lib.mkOption {
Expand All @@ -441,7 +451,7 @@
icons.enable = nixpkgs.lib.mkDefault true;
};
}
(nixpkgs.lib.mkIf cfg.enable {
(nixpkgs.lib.mkIf (cfg.enable && !cfg.withUWSM) {
services =
if nixpkgs.lib.strings.versionAtLeast config.system.nixos.release "24.05"
then {
Expand All @@ -450,6 +460,26 @@
else {
xserver.displayManager.sessionPackages = [cfg.package];
};
})
(nixpkgs.lib.mkIf (cfg.enable && cfg.withUWSM) {
programs.uwsm = {
enable = true;
waylandCompositors = {
niri = {
prettyName = "Niri";
comment = "Niri compositor managed by UWSM";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
prettyName = "Niri";
comment = "Niri compositor managed by UWSM";
prettyName = "niri";
comment = "niri compositor managed by UWSM";

Small nitpick but the "n" isn't meant to be capitalized according to the niri dev.

# Only takes a path, and `niri-session` uses
# the niri default systemd units
binPath = nixpkgs.lib.getExe (
pkgs.writeShellScriptBin "niriSession" ''
exec /run/current-system/sw/bin/niri --session
''
);
Comment on lines +473 to +477

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I have in my config, not sure if this is intended behavior or not, but it does work and would simplify this a bit:

Suggested change
binPath = nixpkgs.lib.getExe (
pkgs.writeShellScriptBin "niriSession" ''
exec /run/current-system/sw/bin/niri --session
''
);
binPath = "/run/current-system/sw/bin/niri -- --session";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised this works, since the -- should come before the compositor command and args1.

Footnotes

  1. https://github.com/Vladimir-csp/uwsm?tab=readme-ov-file#syntax-and-behavior

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems uwsm parses
uwsm start -S -F /run/current-system/sw/bin/niri -- --session and
uwsm start -S -F -- /run/current-system/sw/bin/niri --session
the same way, I guess it could be changed but it doesn't feel like a behavior that should be relied on.

i guess the best would be to add programs.uwsm.waylandCompositors.*.args in nixpkgs

};
};
};
})
(nixpkgs.lib.mkIf cfg.enable {
hardware =
if nixpkgs.lib.strings.versionAtLeast config.system.nixos.release "24.11"
then {
Expand Down
9 changes: 9 additions & 0 deletions settings.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2724,6 +2724,15 @@
'' {
enable = enable-option;
package = package-option;
withUWSM = fake-option "programs.niri.withUWSM" ''
- type: `boolean`
- default: `false`

Whether to enable and configure USWM to start niri.

Disables installation of default niri `.desktop` file. `greetd` or a display manager should
be configured. See `programs.uwsm` NixOs options for more info.
'';
z.cache = fake-option "niri-flake.cache.enable" ''
- type: `boolean`
- default: `true`
Expand Down
Loading