diff options
Diffstat (limited to 'pkgs/desktops/gnome/core/gnome-session')
-rw-r--r-- | pkgs/desktops/gnome/core/gnome-session/ctl.nix | 42 | ||||
-rw-r--r-- | pkgs/desktops/gnome/core/gnome-session/default.nix | 90 | ||||
-rw-r--r-- | pkgs/desktops/gnome/core/gnome-session/fix-paths.patch | 42 |
3 files changed, 174 insertions, 0 deletions
diff --git a/pkgs/desktops/gnome/core/gnome-session/ctl.nix b/pkgs/desktops/gnome/core/gnome-session/ctl.nix new file mode 100644 index 0000000000000..6a274e35bf568 --- /dev/null +++ b/pkgs/desktops/gnome/core/gnome-session/ctl.nix @@ -0,0 +1,42 @@ +{ lib +, stdenv +, fetchFromGitHub +, meson +, ninja +, pkg-config +, glib +, systemd +, wrapGAppsHook +}: + +stdenv.mkDerivation rec { + pname = "gnome-session-ctl"; + version = "40.0"; + + src = fetchFromGitHub { + owner = "nix-community"; + repo = pname; + rev = version; + hash = "sha256-gvBmLx8Qoj1vPsOwaZsd9+pTDvU5D7uUts7ZT1pXwNo="; + }; + + nativeBuildInputs = [ + meson + ninja + pkg-config + wrapGAppsHook + ]; + + buildInputs = [ + glib + systemd + ]; + + meta = with lib; { + description = "gnome-session-ctl extracted from gnome-session for nixpkgs"; + homepage = "https://github.com/nix-community/gnome-session-ctl"; + license = licenses.gpl2Plus; + maintainers = teams.gnome.members; + platforms = platforms.linux; + }; +} diff --git a/pkgs/desktops/gnome/core/gnome-session/default.nix b/pkgs/desktops/gnome/core/gnome-session/default.nix new file mode 100644 index 0000000000000..c1ebc43620715 --- /dev/null +++ b/pkgs/desktops/gnome/core/gnome-session/default.nix @@ -0,0 +1,90 @@ +{ fetchurl, lib, stdenv, substituteAll, meson, ninja, pkg-config, gnome, glib, gtk3, gsettings-desktop-schemas +, gnome-desktop, dbus, json-glib, libICE, xmlto, docbook_xsl, docbook_xml_dtd_412, python3 +, libxslt, gettext, makeWrapper, systemd, xorg, epoxy, gnugrep, bash, gnome-session-ctl }: + +stdenv.mkDerivation rec { + pname = "gnome-session"; + version = "40.1.1"; + + outputs = ["out" "sessions"]; + + src = fetchurl { + url = "mirror://gnome/sources/gnome-session/${lib.versions.major version}/${pname}-${version}.tar.xz"; + sha256 = "10nzyhmgkrzk6i70kj7690na0hmsv6qy5bmr10akxq9jxqlphy4w"; + }; + + patches = [ + (substituteAll { + src = ./fix-paths.patch; + gsettings = "${glib.bin}/bin/gsettings"; + dbusLaunch = "${dbus.lib}/bin/dbus-launch"; + grep = "${gnugrep}/bin/grep"; + bash = "${bash}/bin/bash"; + }) + ]; + + mesonFlags = [ "-Dsystemd=true" "-Dsystemd_session=default" ]; + + nativeBuildInputs = [ + meson ninja pkg-config gettext makeWrapper + xmlto libxslt docbook_xsl docbook_xml_dtd_412 python3 + dbus # for DTD + ]; + + buildInputs = [ + glib gtk3 libICE gnome-desktop json-glib xorg.xtrans gnome.adwaita-icon-theme + gnome.gnome-settings-daemon gsettings-desktop-schemas systemd epoxy + ]; + + postPatch = '' + chmod +x meson_post_install.py # patchShebangs requires executable file + patchShebangs meson_post_install.py + + # Use our provided `gnome-session-ctl` + original="@libexecdir@/gnome-session-ctl" + replacement="${gnome-session-ctl}/libexec/gnome-session-ctl" + + find data/ -type f -name "*.service.in" -exec sed -i \ + -e s,$original,$replacement,g \ + {} + + ''; + + # `bin/gnome-session` will reset the environment when run in wayland, we + # therefor wrap `libexec/gnome-session-binary` instead which is the actual + # binary needing wrapping + preFixup = '' + wrapProgram "$out/libexec/gnome-session-binary" \ + --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ + --suffix XDG_DATA_DIRS : "$out/share:$GSETTINGS_SCHEMAS_PATH" \ + --suffix XDG_DATA_DIRS : "${gnome.gnome-shell}/share"\ + --suffix XDG_CONFIG_DIRS : "${gnome.gnome-settings-daemon}/etc/xdg" + ''; + + # We move the GNOME sessions to another output since gnome-session is a dependency of + # GDM itself. If we do not hide them, it will show broken GNOME sessions when GDM is + # enabled without proper GNOME installation. + postInstall = '' + mkdir $sessions + moveToOutput share/wayland-sessions "$sessions" + moveToOutput share/xsessions "$sessions" + + # Our provided one is being used + rm -rf $out/libexec/gnome-session-ctl + ''; + + passthru = { + updateScript = gnome.updateScript { + packageName = "gnome-session"; + attrPath = "gnome.gnome-session"; + }; + providedSessions = [ "gnome" "gnome-xorg" ]; + }; + + meta = with lib; { + description = "GNOME session manager"; + homepage = "https://wiki.gnome.org/Projects/SessionManagement"; + license = licenses.gpl2Plus; + maintainers = teams.gnome.members; + platforms = platforms.linux; + }; +} diff --git a/pkgs/desktops/gnome/core/gnome-session/fix-paths.patch b/pkgs/desktops/gnome/core/gnome-session/fix-paths.patch new file mode 100644 index 0000000000000..320b3024deee2 --- /dev/null +++ b/pkgs/desktops/gnome/core/gnome-session/fix-paths.patch @@ -0,0 +1,42 @@ +diff --git a/gnome-session/gnome-session.in b/gnome-session/gnome-session.in +index ddd1a591..46a3488b 100755 +--- a/gnome-session/gnome-session.in ++++ b/gnome-session/gnome-session.in +@@ -3,17 +3,19 @@ + if [ "x$XDG_SESSION_TYPE" = "xwayland" ] && + [ "x$XDG_SESSION_CLASS" != "xgreeter" ] && + [ -n "$SHELL" ] && +- grep -q "$SHELL" /etc/shells && +- ! (echo "$SHELL" | grep -q "false") && +- ! (echo "$SHELL" | grep -q "nologin"); then ++ @grep@ -q "$SHELL" /etc/shells && ++ ! (echo "$SHELL" | @grep@ -q "false") && ++ ! (echo "$SHELL" | @grep@ -q "nologin"); then + if [ "$1" != '-l' ]; then +- exec bash -c "exec -l '$SHELL' -c '$0 -l $*'" ++ # Make sure the shell actually sets up the environment. ++ unset __NIXOS_SET_ENVIRONMENT_DONE ++ exec @bash@ -c "exec -l '$SHELL' -c '$0 -l $*'" + else + shift + fi + fi + +-SETTING=$(G_MESSAGES_DEBUG='' gsettings get org.gnome.system.locale region) ++SETTING=$(G_MESSAGES_DEBUG='' @gsettings@ get org.gnome.system.locale region) + REGION=${SETTING#\'} + REGION=${REGION%\'} + +diff --git a/gnome-session/main.c b/gnome-session/main.c +index 84edfbe5..e5285489 100644 +--- a/gnome-session/main.c ++++ b/gnome-session/main.c +@@ -215,7 +215,7 @@ require_dbus_session (int argc, + } + new_argv[i + 2] = NULL; + +- if (!execvp ("dbus-launch", new_argv)) { ++ if (!execvp ("@dbusLaunch@", new_argv)) { + g_set_error (error, + G_SPAWN_ERROR, + G_SPAWN_ERROR_FAILED, |