summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Pykhalov <go.wigust@gmail.com>2025-10-08 16:17:41 +0300
committerOleg Pykhalov <go.wigust@gmail.com>2025-10-10 12:11:12 +0300
commit18ea7bc470e38b655d263847611ac5f0980f0cf8 (patch)
treee9906e9789faef26eea772d5b6773b129c17ffa8
parent2e1be00d0b4a73f60d1cfc06107327dd528cd6f5 (diff)
home: services: Add niri.
This introduces a new home service for Niri, a scrollable tiling Wayland compositor that combines traditional tiling window management with smooth scrolling between workspaces. The service provides: - home-niri-service-type for installing and configuring Niri - Shepherd service that starts Niri in a DBus session - Proper Wayland environment variables (XDG_CURRENT_DESKTOP, XDG_SESSION_DESKTOP, etc.) - Integration with xdg-desktop-portal and related components The service starts Niri with appropriate environment variables for Wayland compatibility and includes necessary dependencies like xdg-desktop-portal-gnome and xdg-desktop-portal-gtk for proper desktop integration. * gnu/home/services/niri.scm: New file containing the service implementation. * gnu/local.mk (GNU_SYSTEM_MODULES): Register the new module. * doc/guix.texi (Niri window manager): Add comprehensive documentation. Change-Id: I9ef081226b4aaa31706d1fbc0d8b7aa1a202cd6e
-rw-r--r--doc/guix.texi30
-rw-r--r--gnu/home/services/niri.scm79
-rw-r--r--gnu/local.mk1
3 files changed, 110 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 9109ce4a388..23062498106 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -49888,6 +49888,7 @@ services)}.
* Mail: Mail Home Services. Services for managing mail.
* Messaging: Messaging Home Services. Services for managing messaging.
* Media: Media Home Services. Services for managing media.
+* Niri: Niri window manager. Setting up the Niri.
* Sway: Sway window manager. Setting up the Sway configuration.
* Networking: Networking Home Services. Networking services.
* Miscellaneous: Miscellaneous Home Services. More services.
@@ -52420,6 +52421,35 @@ object @code{%unset-value} (from @code{(gnu services configuration)}).
@end deffn
+@node Niri window manager
+@subsection Niri window manager
+
+@cindex niri, Home Service
+@cindex niri, configuration
+@cindex Wayland compositor
+@cindex scrollable tiling window manager
+The @code{(gnu home services niri)} module provides the
+@code{home-niri-service-type} service, which installs and configures
+@uref{https://github.com/YaLTeR/niri, Niri}, a scrollable tiling Wayland
+compositor. Niri combines traditional tiling window management with
+smooth scrolling between workspaces.
+
+This service starts Niri as a user-level desktop session with proper
+environment variables configured for Wayland compatibility, including
+@code{XDG_CURRENT_DESKTOP}, @code{XDG_SESSION_DESKTOP}, and
+@code{DESKTOP_SESSION}.
+
+Here is a minimal example service declaration for your
+@code{home-environment} configuration:
+
+@example
+(service home-niri-service-type)
+@end example
+
+For more advanced configurations, you can customize the service with a
+@code{niri-configuration} record to specify additional environment
+variables.
+
@node Sway window manager
@subsection Sway window manager
diff --git a/gnu/home/services/niri.scm b/gnu/home/services/niri.scm
new file mode 100644
index 00000000000..c590b4ca940
--- /dev/null
+++ b/gnu/home/services/niri.scm
@@ -0,0 +1,79 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2025 Oleg Pykhalov <go.wigust@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu home services niri)
+ #:use-module (gnu home services)
+ #:use-module (gnu home services shepherd)
+ #:use-module (gnu packages bash)
+ #:use-module (gnu packages freedesktop)
+ #:use-module (gnu packages glib)
+ #:use-module (gnu packages gnome)
+ #:use-module (gnu packages wm)
+ #:use-module (gnu services)
+ #:use-module (gnu services shepherd)
+ #:use-module (guix gexp)
+ #:use-module (guix records)
+ #:export (niri-configuration
+ home-niri-service-type))
+
+(define-record-type* <niri-configuration>
+ niri-configuration make-niri-configuration
+ niri-configuration?
+ (environment-variables niri-configuration-environment-variables ;list of strings
+ (default '())))
+
+(define (home-niri-shepherd-service config)
+ "Return a shepherd service that runs Niri, a scrollable tiling Wayland
+compositor. The service starts Niri in a DBus session with appropriate
+environment variables set for a Wayland desktop session."
+ (list (shepherd-service
+ (documentation "Run Niri scrollable tiling Wayland compositor.")
+ (provision '(niri))
+ (start #~(make-forkexec-constructor
+ (list #$(file-append bash "/bin/bash") "-l"
+ "-c" "exec dbus-run-session niri --session")
+ #:environment-variables
+ (append (list #$@(niri-configuration-environment-variables config))
+ '("DESKTOP_SESSION=niri"
+ "XDG_CURRENT_DESKTOP=niri"
+ "XDG_SESSION_DESKTOP=niri"
+ "XDG_SESSION_TYPE=wayland")
+ (filter (negate
+ (lambda (str)
+ (string-prefix? "WAYLAND_DISPLAY=" str)))
+ (environ)))))
+ (stop #~(make-kill-destructor)))))
+
+(define home-niri-service-type
+ (service-type
+ (name 'home-niri)
+ (extensions
+ (list (service-extension home-shepherd-service-type
+ home-niri-shepherd-service)
+ (service-extension home-profile-service-type
+ (lambda (config)
+ (list dbus
+ niri
+ xdg-desktop-portal
+ xdg-desktop-portal-gnome
+ xdg-desktop-portal-gtk)))))
+ (description "Install and configure Niri, a scrollable tiling Wayland
+compositor. This service starts Niri as a user-level desktop session with
+proper environment variables set for Wayland compatibility. It ensures Niri
+and its dependencies are available in the user's profile.")
+ (default-value (niri-configuration))))
diff --git a/gnu/local.mk b/gnu/local.mk
index 76f9f173edf..abecf929aa7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -118,6 +118,7 @@ GNU_SYSTEM_MODULES = \
%D%/home/services/messaging.scm \
%D%/home/services/mpv.scm \
%D%/home/services/music.scm \
+ %D%/home/services/niri.scm \
%D%/home/services/pm.scm \
%D%/home/services/shells.scm \
%D%/home/services/shepherd.scm \