From ce0900dd0192fe2960b13cb31d1f5683cc10b4c6 Mon Sep 17 00:00:00 2001 From: Isabella Bastaja Date: Sun, 28 Jun 2026 16:50:20 +0200 Subject: niri: manage ancillary services with systemd --- share/home/niri.nix | 58 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 9 deletions(-) (limited to 'share/home') diff --git a/share/home/niri.nix b/share/home/niri.nix index e3e1061..694b82a 100644 --- a/share/home/niri.nix +++ b/share/home/niri.nix @@ -2,10 +2,10 @@ pkgs, config, inputs, - system, ... }: let + inherit (pkgs) lib; tomlFormat = pkgs.formats.toml { }; screenshot = pkgs.writeScript "ib-screenshot" '' set -xeu pipefail @@ -19,12 +19,22 @@ in ]; # programs.waybar.enable = true; programs.tofi.enable = true; + services.mako.enable = true; services.darkman.enable = true; + services.wpaperd.enable = true; + programs.waybar = { + enable = true; + systemd = { + enable = true; + targets = [ "niri.service" ]; + }; + }; home.packages = [ pkgs.niri-stable pkgs.wpaperd # for wpaperctl pkgs.gnome-keyring + pkgs.soteria # Super strange issue with nautilus: the desktop file only works so long as # I have desktop-file-utils installed *anywhere* on the system. As in, just @@ -96,14 +106,6 @@ in }; }; - spawn-at-startup = [ - { command = [ "${pkgs.xwayland-satellite}/bin/xwayland-satellite" ]; } - { command = [ "${pkgs.mako}/bin/mako" ]; } - { command = [ "${pkgs.wpaperd}/bin/wpaperd" ]; } - { command = [ "${pkgs.soteria}/bin/soteria" ]; } # polkit agent - { command = [ "${pkgs.waybar}/bin/waybar" ]; } - ]; - environment = { QT_QPA_PLATFORM = "wayland"; DISPLAY = ":0"; # for X11 to recognize xwayland-satellite correctly @@ -366,4 +368,42 @@ in }; }; }; + + # from: https://github.com/Supreeeme/xwayland-satellite/blob/8575d0ef55d70f9b4c46b6bffb3accf912217e1e/resources/xwayland-satellite.service + systemd.user.services.xwayland-satellite = { + Unit = { + Description = "Xwayland outside your Wayland"; + BindsTo = [ "niri.service" ]; + PartOf = [ "niri.service" ]; + After = [ "niri.service" ]; + Requisite = [ "niri.service" ]; + }; + + Service = { + Type = "notify"; + NotifyAccess = "all"; + ExecStart = lib.getExe pkgs.xwayland-satellite; + StandardOutput = "journal"; + }; + + Install.WantedBy = lib.mkDefault [ "niri.service" ]; + }; + + systemd.user.services.soteria = { + Unit = { + Description = "Soteria, Polkit authentication agent for any desktop environment"; + Wants = [ "niri.service" ]; + After = [ "niri.service" ]; + }; + + Service = { + ExecStart = lib.getExe pkgs.soteria; + Type = "simple"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + + Install.WantedBy = lib.mkDefault [ "niri.service" ]; + }; } -- cgit v1.3.1