diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/xdg-desktop-portal')
3 files changed, 134 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/default.nix b/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/default.nix new file mode 100644 index 000000000000..0fdcb684b2d5 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/default.nix @@ -0,0 +1,45 @@ +{ stdenv, fetchFromGitHub, substituteAll, autoreconfHook, pkgconfig, libxml2, glib, pipewire, fontconfig, flatpak, gsettings-desktop-schemas, acl, dbus, fuse, wrapGAppsHook }: + +stdenv.mkDerivation rec { + pname = "xdg-desktop-portal"; + version = "1.2.0"; + + outputs = [ "out" "installedTests" ]; + + src = fetchFromGitHub { + owner = "flatpak"; + repo = pname; + rev = version; + sha256 = "1gjyif4gly0mkdx6ir6wc4vhfh1raah9jq03q28i88hr7phjdy71"; + }; + + patches = [ + ./respect-path-env-var.patch + (substituteAll { + src = ./fix-paths.patch; + inherit flatpak; + }) + ]; + + nativeBuildInputs = [ autoreconfHook pkgconfig libxml2 wrapGAppsHook ]; + buildInputs = [ glib pipewire fontconfig flatpak acl dbus fuse gsettings-desktop-schemas ]; + + doCheck = true; # XXX: investigate! + + configureFlags = [ + "--enable-installed-tests" + "--disable-geoclue" # Requires 2.5.2, not released yet + ]; + + makeFlags = [ + "installed_testdir=$(installedTests)/libexec/installed-tests/xdg-desktop-portal" + "installed_test_metadir=$(installedTests)/share/installed-tests/xdg-desktop-portal" + ]; + + meta = with stdenv.lib; { + description = "Desktop integration portals for sandboxed apps"; + license = licenses.lgpl21; + maintainers = with maintainers; [ jtojnar ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/fix-paths.patch b/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/fix-paths.patch new file mode 100644 index 000000000000..f4b103eb38b1 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/fix-paths.patch @@ -0,0 +1,13 @@ +diff --git a/src/notification.c b/src/notification.c +index 1367114..72ba033 100644 +--- a/src/notification.c ++++ b/src/notification.c +@@ -401,7 +401,7 @@ validate_icon_more (GVariant *v) + int status; + g_autofree char *err = NULL; + g_autoptr(GError) error = NULL; +- const char *icon_validator = LIBEXECDIR "/flatpak-validate-icon"; ++ const char *icon_validator = "@flatpak@/libexec/flatpak-validate-icon"; + const char *args[6]; + + if (G_IS_THEMED_ICON (icon)) diff --git a/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/respect-path-env-var.patch b/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/respect-path-env-var.patch new file mode 100644 index 000000000000..f884899ecd19 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/xdg-desktop-portal/respect-path-env-var.patch @@ -0,0 +1,76 @@ +--- a/src/xdg-desktop-portal.c ++++ b/src/xdg-desktop-portal.c +@@ -177,38 +177,50 @@ + static void + load_installed_portals (void) + { +- const char *portal_dir = PKGDATADIR "/portals"; +- g_autoptr(GFile) dir = g_file_new_for_path (portal_dir); +- g_autoptr(GFileEnumerator) enumerator = NULL; + +- enumerator = g_file_enumerate_children (dir, "*", G_FILE_QUERY_INFO_NONE, NULL, NULL); ++ g_auto(GStrv) portal_dir_list; ++ int i; ++ const char *portal_dir = g_getenv ("XDG_DESKTOP_PORTAL_PATH"); ++ ++ if (portal_dir == NULL) ++ portal_dir = PKGDATADIR "/portals"; + +- if (enumerator == NULL) +- return; ++ portal_dir_list = g_strsplit (portal_dir, G_SEARCHPATH_SEPARATOR_S, 0); + +- while (TRUE) ++ for (i = 0; portal_dir_list[i] != NULL; i++) + { +- g_autoptr(GFileInfo) info = g_file_enumerator_next_file (enumerator, NULL, NULL); +- g_autoptr(GFile) child = NULL; +- g_autofree char *path = NULL; +- const char *name; +- g_autoptr(GError) error = NULL; ++ portal_dir = portal_dir_list[i]; ++ g_autoptr(GFile) dir = g_file_new_for_path (portal_dir); ++ g_autoptr(GFileEnumerator) enumerator = NULL; ++ enumerator = g_file_enumerate_children (dir, "*", G_FILE_QUERY_INFO_NONE, NULL, NULL); + +- if (info == NULL) +- break; ++ if (enumerator == NULL) ++ continue; + +- name = g_file_info_get_name (info); ++ while (TRUE) ++ { ++ g_autoptr(GFileInfo) info = g_file_enumerator_next_file (enumerator, NULL, NULL); ++ g_autoptr(GFile) child = NULL; ++ g_autofree char *path = NULL; ++ const char *name; ++ g_autoptr(GError) error = NULL; + +- if (!g_str_has_suffix (name, ".portal")) +- continue; ++ if (info == NULL) ++ break; + +- child = g_file_enumerator_get_child (enumerator, info); +- path = g_file_get_path (child); ++ name = g_file_info_get_name (info); + +- if (!register_portal (path, &error)) +- { +- g_warning ("Error loading %s: %s", path, error->message); +- continue; ++ if (!g_str_has_suffix (name, ".portal")) ++ continue; ++ ++ child = g_file_enumerator_get_child (enumerator, info); ++ path = g_file_get_path (child); ++ ++ if (!register_portal (path, &error)) ++ { ++ g_warning ("Error loading %s: %s", path, error->message); ++ continue; ++ } + } + } + |