Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pantheon: manage user session with systemd #140429

Merged
merged 5 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions nixos/modules/services/x11/desktop-managers/pantheon.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]";
After = "[email protected]";
};

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
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/x11/display-managers/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions nixos/tests/pantheon.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ["[email protected]", "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'")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ let
export XDG_DATA_DIRS=@out@/share:$XDG_DATA_DIRS

# Start pantheon session. Keep in sync with upstream
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a link where upstream has it defined?

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
Expand Down
3 changes: 3 additions & 0 deletions pkgs/desktops/pantheon/desktop/gala/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]' -i 'data/[email protected]'
'';

passthru = {
Expand Down
Loading