diff options
author | Bobby Rong <rjl931189261@126.com> | 2024-03-29 22:55:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-29 22:55:39 +0800 |
commit | e96d5c13d06932e0a6fca5d0ec2224ff5f54b852 (patch) | |
tree | bad932e53393435beff5105a3d396fa1d397c425 | |
parent | 58f6e5b63d670c3882e6d7f44e8523bdf9c47c0e (diff) | |
parent | bf2ba6e62972d4f7fc1e788747344530089e5ece (diff) |
Merge pull request #140429 from bobby285271/pantheon-systemd
pantheon: manage user session with systemd
5 files changed, 36 insertions, 7 deletions
diff --git a/nixos/modules/services/x11/desktop-managers/pantheon.nix b/nixos/modules/services/x11/desktop-managers/pantheon.nix index 59bc142eeb7f9..2cfdc69b86e06 100644 --- a/nixos/modules/services/x11/desktop-managers/pantheon.nix +++ b/nixos/modules/services/x11/desktop-managers/pantheon.nix @@ -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 diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index 3e2d5780a5cb1..c22048c6692e9 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -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 diff --git a/nixos/tests/pantheon.nix b/nixos/tests/pantheon.nix index 69a28c397bedc..14f92fa3af4a2 100644 --- a/nixos/tests/pantheon.nix +++ b/nixos/tests/pantheon.nix @@ -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'") diff --git a/pkgs/desktops/pantheon/desktop/elementary-session-settings/default.nix b/pkgs/desktops/pantheon/desktop/elementary-session-settings/default.nix index dff4189a1a2de..2588a133ba7bb 100644 --- a/pkgs/desktops/pantheon/desktop/elementary-session-settings/default.nix +++ b/pkgs/desktops/pantheon/desktop/elementary-session-settings/default.nix @@ -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 diff --git a/pkgs/desktops/pantheon/desktop/gala/default.nix b/pkgs/desktops/pantheon/desktop/gala/default.nix index 61d9c120b2461..123870c356de0 100644 --- a/pkgs/desktops/pantheon/desktop/gala/default.nix +++ b/pkgs/desktops/pantheon/desktop/gala/default.nix @@ -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 = { |