Merge pull request #140429 from bobby285271/pantheon-systemd

pantheon: manage user session with systemd
This commit is contained in:
Bobby Rong 2024-03-29 22:55:39 +08:00 committed by GitHub
commit e96d5c13d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 36 additions and 7 deletions

View file

@ -174,12 +174,38 @@ in
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1443
pkgs.pantheon.mutter
];
systemd.packages = [
pkgs.pantheon.gnome-settings-daemon
systemd.packages = with pkgs; [
gnome.gnome-session
pantheon.gala
pantheon.gnome-settings-daemon
pantheon.elementary-session-settings
];
programs.dconf.enable = true;
networking.networkmanager.enable = mkDefault true;
systemd.user.targets."gnome-session-x11-services".wants = [
"org.gnome.SettingsDaemon.XSettings.service"
];
systemd.user.targets."gnome-session-x11-services-ready".wants = [
"org.gnome.SettingsDaemon.XSettings.service"
];
# https://github.com/elementary/gala/issues/1826#issuecomment-1890461298
systemd.user.services."io.elementary.gala.daemon@" = {
unitConfig = {
Description = "Gala Daemon";
BindsTo = "io.elementary.gala@.service";
After = "io.elementary.gala@.service";
};
serviceConfig = {
Type = "dbus";
BusName = "org.pantheon.gala.daemon";
ExecStart = "${pkgs.pantheon.gala}/bin/gala-daemon";
Slice = "session.slice";
};
};
# Global environment
environment.systemPackages = (with pkgs.pantheon; [
elementary-session-settings

View file

@ -40,7 +40,7 @@ let
IFS=:
for i in $XDG_CURRENT_DESKTOP; do
case $i in
KDE|GNOME|X-NIXOS-SYSTEMD-AWARE) echo "1"; exit; ;;
KDE|GNOME|Pantheon|X-NIXOS-SYSTEMD-AWARE) echo "1"; exit; ;;
*) ;;
esac
done

View file

@ -50,11 +50,11 @@ import ./make-test-python.nix ({ pkgs, lib, ...} :
machine.wait_until_succeeds(f"pgrep -f {i}")
for i in ["gala", "io.elementary.wingpanel", "plank"]:
machine.wait_for_window(i)
machine.wait_for_unit("bamfdaemon.service", "${user.name}")
machine.wait_for_unit("io.elementary.files.xdg-desktop-portal.service", "${user.name}")
for i in ["io.elementary.gala.daemon@x11.service", "bamfdaemon.service", "io.elementary.files.xdg-desktop-portal.service"]:
machine.wait_for_unit(i, "${user.name}")
with subtest("Check if various environment variables are set"):
cmd = "xargs --null --max-args=1 echo < /proc/$(pgrep -xf /run/current-system/sw/bin/gala)/environ"
cmd = "xargs --null --max-args=1 echo < /proc/$(pgrep -xf ${pkgs.pantheon.gala}/bin/gala)/environ"
machine.succeed(f"{cmd} | grep 'XDG_CURRENT_DESKTOP' | grep 'Pantheon'")
# Hopefully from the sessionPath option.
machine.succeed(f"{cmd} | grep 'XDG_DATA_DIRS' | grep 'gsettings-schemas/pantheon-agent-geoclue2'")

View file

@ -72,7 +72,7 @@ let
export XDG_DATA_DIRS=@out@/share:$XDG_DATA_DIRS
# Start pantheon session. Keep in sync with upstream
exec ${gnome-session}/bin/gnome-session --builtin --session=pantheon "$@"
exec ${gnome-session}/bin/gnome-session --session=pantheon "$@"
'';
# Absolute path patched version of the upstream xsession

View file

@ -70,6 +70,9 @@ stdenv.mkDerivation rec {
postPatch = ''
chmod +x build-aux/meson/post_install.py
patchShebangs build-aux/meson/post_install.py
# https://github.com/elementary/gala/issues/1826#issuecomment-1890461298
sed '2i Wants=io.elementary.gala.daemon@.service' -i 'data/gala@x11.service.in'
'';
passthru = {