Unverified Commit e96d5c13 authored by Bobby Rong's avatar Bobby Rong Committed by GitHub
Browse files

Merge pull request #140429 from bobby285271/pantheon-systemd

pantheon: manage user session with systemd
parents 58f6e5b6 bf2ba6e6
Loading
Loading
Loading
Loading
+28 −2
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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
+3 −3
Original line number Diff line number Diff line
@@ -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'")
+1 −1
Original line number Diff line number Diff line
@@ -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
+3 −0
Original line number Diff line number Diff line
@@ -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 = {