From 13d9fa4a2bb0c20c3312c590ff80afddbe55ec79 Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Wed, 5 Jun 2024 21:01:47 +0800 Subject: [PATCH] pantheon.elementary-session-settings: Build wayland session Finally finishes issue 237954. --- .../elementary-session-settings/default.nix | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/pkgs/desktops/pantheon/desktop/elementary-session-settings/default.nix b/pkgs/desktops/pantheon/desktop/elementary-session-settings/default.nix index 8790cc68c41b..885f46cebcba 100644 --- a/pkgs/desktops/pantheon/desktop/elementary-session-settings/default.nix +++ b/pkgs/desktops/pantheon/desktop/elementary-session-settings/default.nix @@ -61,7 +61,7 @@ let X-GNOME-Autostart-Phase=EarlyInitialization ''; - executable = writeScript "pantheon" '' + common-export = '' # gnome-session can find RequiredComponents for `pantheon` session (notably pantheon's patched g-s-d autostarts) export XDG_CONFIG_DIRS=@out@/etc/xdg:$XDG_CONFIG_DIRS @@ -71,10 +71,17 @@ let # * gnome-session can find the `pantheon' session # * use pantheon-mimeapps.list export XDG_DATA_DIRS=@out@/share:$XDG_DATA_DIRS + ''; + executable = writeScript "pantheon" (common-export + '' # Start pantheon session. Keep in sync with upstream exec ${gnome-session}/bin/gnome-session --session=pantheon "$@" - ''; + ''); + + executable-wayland = writeScript "pantheon-wayland" (common-export + '' + # Start pantheon-wayland session. Keep in sync with upstream + exec ${gnome-session}/bin/gnome-session --session=pantheon-wayland "$@" + ''); # Absolute path patched version of the upstream xsession xsession = writeText "pantheon.desktop" '' @@ -88,6 +95,16 @@ let Type=Application ''; + wayland-session = writeText "pantheon-wayland.desktop" '' + [Desktop Entry] + Name=Pantheon (Wayland) + Comment=This session provides elementary experience + Exec=@out@/libexec/pantheon-wayland + TryExec=${wingpanel}/bin/io.elementary.wingpanel + Icon= + DesktopNames=Pantheon + Type=Application + ''; in stdenv.mkDerivation rec { @@ -122,6 +139,7 @@ stdenv.mkDerivation rec { "-Dfallback-session=GNOME" "-Ddetect-program-prefixes=true" "--sysconfdir=${placeholder "out"}/etc" + "-Dwayland=true" ]; postInstall = '' @@ -136,10 +154,12 @@ stdenv.mkDerivation rec { # script `Exec` to start pantheon mkdir -p $out/libexec substitute ${executable} $out/libexec/pantheon --subst-var out - chmod +x $out/libexec/pantheon + substitute ${executable-wayland} $out/libexec/pantheon-wayland --subst-var out + chmod +x $out/libexec/pantheon{,-wayland} - # absolute path patched xsession + # absolute path patched sessions substitute ${xsession} $out/share/xsessions/pantheon.desktop --subst-var out + substitute ${wayland-session} $out/share/wayland-sessions/pantheon-wayland.desktop --subst-var out ''; passthru = { @@ -147,6 +167,7 @@ stdenv.mkDerivation rec { providedSessions = [ "pantheon" + "pantheon-wayland" ]; };