media1: use UWSM for Hyprland session management

Matches the working pattern from gunter — UWSM properly sets up dbus
and systemd targets, which is needed for PipeWire and xdg-desktop-portal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 19:22:33 +01:00
parent 35e62dafbc
commit f87e004153

View File

@@ -11,7 +11,7 @@ let
p.inputstream-adaptive
]);
hyprlandConfig = pkgs.writeText "hyprland.conf" ''
hyprlandConfig = ''
# Monitor auto-detect, native resolution
monitor = , preferred, auto, 1
@@ -54,31 +54,37 @@ let
disable_splash_rendering = true
}
'';
launchHyprland = pkgs.writeShellApplication {
name = "launch-hyprland";
runtimeInputs = [ pkgs.hyprland ];
text = ''
export XDG_SESSION_TYPE=wayland
exec Hyprland --config ${hyprlandConfig}
'';
};
in
{
# Hyprland compositor
programs.hyprland.enable = true;
# Hyprland compositor with UWSM for proper dbus/systemd session management
programs.hyprland = {
enable = true;
withUWSM = true;
portalPackage = pkgs.xdg-desktop-portal-hyprland;
};
# greetd for auto-login into Hyprland
# greetd for auto-login — UWSM starts Hyprland as a systemd session
services.greetd = {
enable = true;
settings = {
default_session = {
command = lib.getExe launchHyprland;
command = "uwsm start hyprland-uwsm.desktop";
user = "kodi";
};
};
};
# Deploy Hyprland config to kodi user's XDG config dir
systemd.tmpfiles.rules = [
"d /home/kodi/.config/hypr 0755 kodi kodi -"
];
environment.etc."skel/hypr/hyprland.conf".text = hyprlandConfig;
system.activationScripts.hyprlandConfig = lib.stringAfter [ "users" ] ''
install -D -o kodi -g kodi -m 0644 /dev/stdin /home/kodi/.config/hypr/hyprland.conf <<'HYPRCONF'
${hyprlandConfig}
HYPRCONF
'';
# Kodi user
users.users.kodi = {
isNormalUser = true;