programs/gnome-session: fix and refactor executable location for built-in managed sessions

This commit is contained in:
Gabriel Arazas 2024-01-04 17:31:40 +08:00
parent 1299b8156a
commit 51d123f667
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -206,7 +206,11 @@ let
}; };
}; };
config = { config = let
scriptName = "${session.name}-${name}-script";
script = "${config.scriptPackage}/bin/${scriptName}";
in
{
id = "${session.name}.${name}"; id = "${session.name}.${name}";
# Make with the default configurations for the built-in-managed # Make with the default configurations for the built-in-managed
@ -214,7 +218,7 @@ let
desktopConfig = { desktopConfig = {
name = lib.mkForce config.id; name = lib.mkForce config.id;
desktopName = lib.mkDefault "${session.fullName} - ${config.description}"; desktopName = lib.mkDefault "${session.fullName} - ${config.description}";
exec = lib.mkForce config.scriptPackage; exec = lib.mkForce script;
noDisplay = lib.mkForce true; noDisplay = lib.mkForce true;
onlyShowIn = [ "X-${session.fullName}" ]; onlyShowIn = [ "X-${session.fullName}" ];
extraConfig = { extraConfig = {
@ -250,7 +254,7 @@ let
DOES A LOT, ALRIGHT! CUT ME SOME SLACK! DOES A LOT, ALRIGHT! CUT ME SOME SLACK!
*/ */
serviceUnit = { serviceUnit = {
script = lib.mkAfter "${config.scriptPackage}/bin/${session.name}-${name}-script"; script = lib.mkAfter script;
description = lib.mkDefault config.description; description = lib.mkDefault config.description;
# The typical workflow for service units to have them set as part of # The typical workflow for service units to have them set as part of
@ -299,7 +303,7 @@ let
}; };
scriptPackage = pkgs.writeShellApplication { scriptPackage = pkgs.writeShellApplication {
name = "${session.name}-${name}-script"; name = scriptName;
runtimeInputs = [ cfg.package pkgs.dbus ]; runtimeInputs = [ cfg.package pkgs.dbus ];
text = '' text = ''
DESKTOP_AUTOSTART_ID="''${DESKTOP_AUTOSTART_ID:-}" DESKTOP_AUTOSTART_ID="''${DESKTOP_AUTOSTART_ID:-}"