This repository has been archived by the owner on Feb 6, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xdg-utils: unstable-2023-12-04 -> 1.2.0
- Loading branch information
Showing
3 changed files
with
314 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
From 835eed6a2b975fba40c3ac18b4cf5429ba9d2836 Mon Sep 17 00:00:00 2001 | ||
From: Luna Nova <git@lunnova.dev> | ||
Date: Wed, 7 Sep 2022 08:45:56 -0700 | ||
Subject: [PATCH] xdg-open: add $XDG_OPEN_USE_PORTAL env var | ||
|
||
When set, the same mechanism that is used in a flatpak is used, | ||
a dbus call to the portal. This is useful for distros with non-flatpak | ||
wrapper or sandboxing features which require the same treatment, eg NixOS. | ||
|
||
See https://github.com/NixOS/nixpkgs/issues/160923 | ||
--- | ||
scripts/xdg-open.in | 4 ++++ | ||
1 file changed, 4 insertions(+) | ||
|
||
diff --git a/scripts/xdg-open.in b/scripts/xdg-open.in | ||
index 8de839a..80d8fb3 100644 | ||
--- a/scripts/xdg-open.in | ||
+++ b/scripts/xdg-open.in | ||
@@ -508,6 +508,10 @@ if [ x"$DE" = x"" ]; then | ||
DE=generic | ||
fi | ||
|
||
+if [ -n "$NIXOS_XDG_OPEN_USE_PORTAL" ]; then | ||
+ DE=flatpak | ||
+fi | ||
+ | ||
DEBUG 2 "Selected DE $DE" | ||
|
||
# sanitize BROWSER (avoid calling ourselves in particular) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,283 @@ | ||
{ | ||
lib, | ||
stdenv, | ||
fetchFromGitLab, | ||
fetchFromGitHub, | ||
fetchpatch, | ||
writeText, | ||
# docs deps | ||
libxslt, | ||
docbook_xml_dtd_412, | ||
docbook_xml_dtd_43, | ||
docbook_xsl, | ||
xmlto, | ||
# runtime deps | ||
resholve, | ||
bash, | ||
coreutils, | ||
dbus, | ||
file, | ||
gawk, | ||
gnugrep, | ||
gnused, | ||
jq, | ||
nettools, | ||
procmail, | ||
procps, | ||
perl, | ||
perlPackages, | ||
mimiSupport ? false, | ||
withXdgOpenUsePortalPatch ? true, | ||
}: let | ||
# A much better xdg-open | ||
mimisrc = fetchFromGitHub { | ||
owner = "march-linux"; | ||
repo = "mimi"; | ||
rev = "8e0070f17bcd3612ee83cb84e663e7c7fabcca3d"; | ||
sha256 = "15gw2nyrqmdsdin8gzxihpn77grhk9l97jp7s7pr7sl4n9ya2rpj"; | ||
}; | ||
|
||
# Required by the common desktop detection code | ||
commonDeps = [dbus coreutils gnugrep gnused]; | ||
commonFakes = [ | ||
"explorer.exe" | ||
"gnome-default-applications-properties" | ||
"kde-config" | ||
"xprop" | ||
]; | ||
|
||
# This is still required to work around the eval trickery some scripts do | ||
commonPrologue = "${writeText "xdg-utils-prologue" '' | ||
export PATH=$PATH:${coreutils}/bin | ||
''}"; | ||
|
||
solutions = [ | ||
{ | ||
scripts = ["bin/xdg-desktop-icon"]; | ||
interpreter = "${bash}/bin/bash"; | ||
inputs = commonDeps; | ||
fake.external = | ||
commonFakes | ||
++ [ | ||
"gconftool-2" | ||
"xdg-user-dir" | ||
]; | ||
keep."$KDE_SESSION_VERSION" = true; | ||
prologue = commonPrologue; | ||
} | ||
|
||
{ | ||
scripts = ["bin/xdg-desktop-menu"]; | ||
interpreter = "${bash}/bin/bash"; | ||
inputs = commonDeps ++ [gawk]; | ||
fake.external = commonFakes; | ||
keep."$KDE_SESSION_VERSION" = true; | ||
prologue = commonPrologue; | ||
} | ||
|
||
{ | ||
scripts = ["bin/xdg-email"]; | ||
interpreter = "${bash}/bin/bash"; | ||
inputs = commonDeps ++ [gawk "${placeholder "out"}/bin"]; | ||
execer = [ | ||
"cannot:${placeholder "out"}/bin/xdg-mime" | ||
"cannot:${placeholder "out"}/bin/xdg-open" | ||
]; | ||
fake.external = | ||
commonFakes | ||
++ [ | ||
"exo-open" | ||
"gconftool-2" | ||
"gdbus" | ||
"gio" | ||
"gnome-open" | ||
"gvfs-open" | ||
"qtxdg-mat" | ||
"xdg-email-hook.sh" | ||
]; | ||
fix."/bin/echo" = true; | ||
keep = { | ||
"$command" = true; | ||
"$kreadconfig" = true; | ||
"$THUNDERBIRD" = true; | ||
"$utf8" = true; | ||
}; | ||
} | ||
|
||
{ | ||
scripts = ["bin/xdg-icon-resource"]; | ||
interpreter = "${bash}/bin/bash"; | ||
inputs = commonDeps; | ||
fake.external = commonFakes; | ||
keep."$KDE_SESSION_VERSION" = true; | ||
prologue = commonPrologue; | ||
} | ||
|
||
{ | ||
scripts = ["bin/xdg-mime"]; | ||
interpreter = "${bash}/bin/bash"; | ||
inputs = commonDeps ++ [file gawk]; | ||
fake.external = | ||
commonFakes | ||
++ [ | ||
"gio" | ||
"gnomevfs-info" | ||
"gvfs-info" | ||
"kde4-config" | ||
"kfile" | ||
"kmimetypefinder" | ||
"kmimetypefinder5" | ||
"ktraderclient" | ||
"ktradertest" | ||
"mimetype" | ||
"qtpaths" | ||
"qtxdg-mat" | ||
]; | ||
fix."/usr/bin/file" = true; | ||
keep = { | ||
"$KDE_SESSION_VERSION" = true; | ||
"$KTRADER" = true; | ||
}; | ||
} | ||
|
||
{ | ||
scripts = ["bin/xdg-open"]; | ||
interpreter = "${bash}/bin/bash"; | ||
inputs = commonDeps ++ [nettools "${placeholder "out"}/bin"]; | ||
execer = [ | ||
"cannot:${placeholder "out"}/bin/xdg-mime" | ||
]; | ||
fake.external = | ||
commonFakes | ||
++ [ | ||
"cygstart" | ||
"dde-open" | ||
"enlightenment_open" | ||
"env" | ||
"exo-open" | ||
"gdbus" | ||
"gio" | ||
"gnome-open" | ||
"gvfs-open" | ||
"kde-open" | ||
"kfmclient" | ||
"mate-open" | ||
"mimeopen" | ||
"open" | ||
"pcmanfm" | ||
"qtxdg-mat" | ||
"run-mailcap" | ||
"rundll32.exe" | ||
"wslpath" | ||
|
||
# actually part of a doc string, resholve bug? | ||
"troublesome" | ||
]; | ||
keep = { | ||
"$browser" = true; | ||
"$KDE_SESSION_VERSION" = true; | ||
"$printf" = true; | ||
}; | ||
} | ||
|
||
{ | ||
scripts = ["bin/xdg-screensaver"]; | ||
interpreter = "${bash}/bin/bash"; | ||
inputs = commonDeps ++ [nettools perl procmail procps]; | ||
fake.external = | ||
commonFakes | ||
++ [ | ||
"dcop" | ||
"mate-screensaver-command" | ||
"xautolock" | ||
"xscreensaver-command" | ||
"xset" | ||
]; | ||
keep = { | ||
"$lockfile_command" = true; | ||
"$MV" = true; | ||
"$XPROP" = true; | ||
}; | ||
prologue = "${writeText "xdg-screensaver-prologue" '' | ||
export PERL5LIB=${with perlPackages; makePerlPath [NetDBus XMLTwig XMLParser X11Protocol]} | ||
export PATH=$PATH:${coreutils}/bin | ||
''}"; | ||
} | ||
|
||
{ | ||
scripts = ["bin/xdg-settings"]; | ||
interpreter = "${bash}/bin/bash"; | ||
inputs = commonDeps ++ [jq "${placeholder "out"}/bin"]; | ||
execer = [ | ||
"cannot:${placeholder "out"}/bin/xdg-mime" | ||
]; | ||
fake.external = | ||
commonFakes | ||
++ [ | ||
"gconftool-2" | ||
"kreadconfig" | ||
"kreadconfig5" | ||
"kreadconfig6" | ||
"ktradertest" | ||
"kwriteconfig" | ||
"kwriteconfig5" | ||
"kwriteconfig6" | ||
"qtxdg-mat" | ||
]; | ||
keep = { | ||
"$KDE_SESSION_VERSION" = true; | ||
# get_browser_$handler | ||
"$handler" = true; | ||
}; | ||
} | ||
]; | ||
in | ||
stdenv.mkDerivation rec { | ||
pname = "xdg-utils"; | ||
version = "1.2.0"; | ||
|
||
src = fetchFromGitLab { | ||
domain = "gitlab.freedesktop.org"; | ||
owner = "xdg"; | ||
repo = "xdg-utils"; | ||
rev = "v${version}"; | ||
hash = "sha256-rjNIO4B9jHsBmPaugWTMqTGNpjiw0MTEmf9/ds2Mud4="; | ||
}; | ||
|
||
patches = | ||
[ | ||
# Backport typo fix | ||
(fetchpatch { | ||
url = "https://gitlab.freedesktop.org/xdg/xdg-utils/-/commit/af2fe0d1dcbcd982d84ddf2bbd174afe90976ed9.patch"; | ||
hash = "sha256-HhQk06wWkyWjSxjXet+sADKf1irswKxDA8WuOknZKRs="; | ||
}) | ||
] | ||
++ lib.optionals withXdgOpenUsePortalPatch [ | ||
# Allow forcing the use of XDG portals using NIXOS_XDG_OPEN_USE_PORTAL environment variable. | ||
# Upstream PR: https://github.com/freedesktop/xdg-utils/pull/12 | ||
./allow-forcing-portal-use.patch | ||
]; | ||
|
||
# just needed when built from git | ||
nativeBuildInputs = [libxslt docbook_xml_dtd_412 docbook_xml_dtd_43 docbook_xsl xmlto]; | ||
|
||
# explicitly provide a runtime shell so patchShebangs is consistent across build platforms | ||
buildInputs = [bash]; | ||
|
||
postInstall = lib.optionalString mimiSupport '' | ||
cp ${mimisrc}/xdg-open $out/bin/xdg-open | ||
''; | ||
|
||
preFixup = lib.concatStringsSep "\n" (map (resholve.phraseSolution "xdg-utils-resholved") solutions); | ||
|
||
meta = with lib; { | ||
homepage = "https://www.freedesktop.org/wiki/Software/xdg-utils/"; | ||
description = "A set of command line tools that assist applications with a variety of desktop integration tasks"; | ||
license = | ||
if mimiSupport | ||
then licenses.gpl2 | ||
else licenses.mit; | ||
maintainers = [maintainers.eelco]; | ||
platforms = platforms.all; | ||
}; | ||
} |