lol

xdg-utils: add patch which adds NIXOS_XDG_OPEN_USE_PORTAL env var

from https://github.com/freedesktop/xdg-utils/pull/12

authored by

Luna Nova and committed by
Bjørn Forsman
eaab93d6 9e23f711

+37 -1
+29
pkgs/tools/X11/xdg-utils/allow-forcing-portal-use.patch
···
··· 1 + From 835eed6a2b975fba40c3ac18b4cf5429ba9d2836 Mon Sep 17 00:00:00 2001 2 + From: Luna Nova <git@lunnova.dev> 3 + Date: Wed, 7 Sep 2022 08:45:56 -0700 4 + Subject: [PATCH] xdg-open: add $XDG_OPEN_USE_PORTAL env var 5 + 6 + When set, the same mechanism that is used in a flatpak is used, 7 + a dbus call to the portal. This is useful for distros with non-flatpak 8 + wrapper or sandboxing features which require the same treatment, eg NixOS. 9 + 10 + See https://github.com/NixOS/nixpkgs/issues/160923 11 + --- 12 + scripts/xdg-open.in | 4 ++++ 13 + 1 file changed, 4 insertions(+) 14 + 15 + diff --git a/scripts/xdg-open.in b/scripts/xdg-open.in 16 + index 8de839a..80d8fb3 100644 17 + --- a/scripts/xdg-open.in 18 + +++ b/scripts/xdg-open.in 19 + @@ -508,6 +508,10 @@ if [ x"$DE" = x"" ]; then 20 + DE=generic 21 + fi 22 + 23 + +if [ -n "$NIXOS_XDG_OPEN_USE_PORTAL" ]; then 24 + + DE=flatpak 25 + +fi 26 + + 27 + DEBUG 2 "Selected DE $DE" 28 + 29 + # sanitize BROWSER (avoid calling ourselves in particular)
+8 -1
pkgs/tools/X11/xdg-utils/default.nix
··· 1 { lib, stdenv, fetchFromGitLab, fetchFromGitHub 2 , file, libxslt, docbook_xml_dtd_412, docbook_xsl, xmlto 3 , w3m, gnugrep, gnused, coreutils, xset, perlPackages 4 - , mimiSupport ? false, gawk }: 5 6 let 7 # A much better xdg-open ··· 29 rev = "d11b33ec7f24cfb1546f6b459611d440013bdc72"; 30 sha256 = "sha256-8PtXfI8hRneEpnUvIV3M+6ACjlkx0w/NEiJFdGbbHnQ="; 31 }; 32 33 # just needed when built from git 34 nativeBuildInputs = [ libxslt docbook_xml_dtd_412 docbook_xsl xmlto w3m ];
··· 1 { lib, stdenv, fetchFromGitLab, fetchFromGitHub 2 , file, libxslt, docbook_xml_dtd_412, docbook_xsl, xmlto 3 , w3m, gnugrep, gnused, coreutils, xset, perlPackages 4 + , mimiSupport ? false, gawk 5 + , withXdgOpenUsePortalPatch ? true }: 6 7 let 8 # A much better xdg-open ··· 30 rev = "d11b33ec7f24cfb1546f6b459611d440013bdc72"; 31 sha256 = "sha256-8PtXfI8hRneEpnUvIV3M+6ACjlkx0w/NEiJFdGbbHnQ="; 32 }; 33 + 34 + patches = lib.optionals withXdgOpenUsePortalPatch [ 35 + # Allow forcing the use of XDG portals using NIXOS_XDG_OPEN_USE_PORTAL environment variable. 36 + # Upstream PR: https://github.com/freedesktop/xdg-utils/pull/12 37 + ./allow-forcing-portal-use.patch 38 + ]; 39 40 # just needed when built from git 41 nativeBuildInputs = [ libxslt docbook_xml_dtd_412 docbook_xsl xmlto w3m ];