From acf6b15f946a74c61ed6a6266be47ec550149c21 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Fri, 11 Oct 2024 09:19:30 +0200 Subject: [PATCH] gnome-settings-daemon: add withSystemd option Since 7f2a6f17fccf ("xdg-desktop-portal-gtk: Enable all default portals unconditionally"), building gnome-settings-daemon is necessary to build xdg-desktop-portal-gtk, but it wasn't possible for systems that can't use systemd. I've called the option "withSystemd" as it's the most common name for this kind of option in Nixpkgs. A couple of backports are required for it to build. They can be removed when we update to GNOME 47. --- .../gn/gnome-settings-daemon/package.nix | 75 ++++++++++++------- 1 file changed, 48 insertions(+), 27 deletions(-) diff --git a/pkgs/by-name/gn/gnome-settings-daemon/package.nix b/pkgs/by-name/gn/gnome-settings-daemon/package.nix index 8f9b06f0dfda..7466859ec72e 100644 --- a/pkgs/by-name/gn/gnome-settings-daemon/package.nix +++ b/pkgs/by-name/gn/gnome-settings-daemon/package.nix @@ -3,6 +3,7 @@ lib, substituteAll, fetchurl, + fetchpatch, meson, ninja, pkg-config, @@ -37,6 +38,7 @@ tzdata, gcr_4, gnome-session-ctl, + withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, }: stdenv.mkDerivation (finalAttrs: { @@ -56,6 +58,18 @@ stdenv.mkDerivation (finalAttrs: { src = ./fix-paths.patch; inherit tzdata; }) + + (fetchpatch { + name = "backport-no-systemd-fix-1.patch"; + url = "https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/commit/46f998d7308cb18832666bc34ee54b1d9c27739f.patch"; + includes = [ "plugins/sharing/gsd-sharing-manager.c" ]; + hash = "sha256-P5FJUY50Pg3MuwHwGUz28/TMZkT7j+fmGPozWb9rVYo="; + }) + (fetchpatch { + name = "backport-no-systemd-fix-2.patch"; + url = "https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/commit/1a4d50f4ee611bdede6072c0bfd2a1b2e327c5fc.patch"; + hash = "sha256-pROhnE9GziS9h0nMWZBsd8YtW6RxMrwmaSOe0UtkUJU="; + }) ]; nativeBuildInputs = [ @@ -71,34 +85,41 @@ stdenv.mkDerivation (finalAttrs: { python3 ]; - buildInputs = [ - gtk3 - glib - gsettings-desktop-schemas - modemmanager - networkmanager - libnotify - libgnomekbd # for org.gnome.libgnomekbd.keyboard schema - gnome-desktop - libpulseaudio - alsa-lib - libcanberra-gtk3 - upower - colord - libgweather - polkit - geocode-glib_2 - geoclue2 - systemd - libgudev - libwacom - gcr_4 - ]; + buildInputs = + [ + gtk3 + glib + gsettings-desktop-schemas + modemmanager + networkmanager + libnotify + libgnomekbd # for org.gnome.libgnomekbd.keyboard schema + gnome-desktop + libpulseaudio + alsa-lib + libcanberra-gtk3 + upower + colord + libgweather + polkit + geocode-glib_2 + geoclue2 + libgudev + libwacom + gcr_4 + ] + ++ lib.optionals withSystemd [ + systemd + ]; - mesonFlags = [ - "-Dudev_dir=${placeholder "out"}/lib/udev" - "-Dgnome_session_ctl_path=${gnome-session-ctl}/libexec/gnome-session-ctl" - ]; + mesonFlags = + [ + "-Dudev_dir=${placeholder "out"}/lib/udev" + (lib.mesonBool "systemd" withSystemd) + ] + ++ lib.optionals withSystemd [ + "-Dgnome_session_ctl_path=${gnome-session-ctl}/libexec/gnome-session-ctl" + ]; # Default for release buildtype but passed manually because # we're using plain