2022-04-15 01:41:22 +00:00
|
|
|
{ lib, stdenv, fetchFromGitLab, fetchFromGitHub
|
2020-04-24 23:36:52 +00:00
|
|
|
, file, libxslt, docbook_xml_dtd_412, docbook_xsl, xmlto
|
|
|
|
, w3m, gnugrep, gnused, coreutils, xset, perlPackages
|
2022-12-17 10:02:37 +00:00
|
|
|
, mimiSupport ? false, gawk
|
|
|
|
, glib
|
|
|
|
, withXdgOpenUsePortalPatch ? true }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
# A much better xdg-open
|
|
|
|
mimisrc = fetchFromGitHub {
|
|
|
|
owner = "march-linux";
|
|
|
|
repo = "mimi";
|
|
|
|
rev = "8e0070f17bcd3612ee83cb84e663e7c7fabcca3d";
|
|
|
|
sha256 = "15gw2nyrqmdsdin8gzxihpn77grhk9l97jp7s7pr7sl4n9ya2rpj";
|
|
|
|
};
|
|
|
|
|
|
|
|
perlPath = with perlPackages; makePerlPath [
|
|
|
|
NetDBus XMLTwig XMLParser X11Protocol
|
|
|
|
];
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "xdg-utils";
|
2021-02-05 17:12:51 +00:00
|
|
|
version = "unstable-2020-10-21";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
src = fetchFromGitLab {
|
|
|
|
domain = "gitlab.freedesktop.org";
|
|
|
|
owner = "xdg";
|
|
|
|
repo = "xdg-utils";
|
2021-02-05 17:12:51 +00:00
|
|
|
rev = "d11b33ec7f24cfb1546f6b459611d440013bdc72";
|
|
|
|
sha256 = "sha256-8PtXfI8hRneEpnUvIV3M+6ACjlkx0w/NEiJFdGbbHnQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
patches = 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
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# just needed when built from git
|
2022-06-26 10:26:21 +00:00
|
|
|
nativeBuildInputs = [ libxslt docbook_xml_dtd_412 docbook_xsl xmlto w3m ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
postInstall = lib.optionalString mimiSupport ''
|
2020-04-24 23:36:52 +00:00
|
|
|
cp ${mimisrc}/xdg-open $out/bin/xdg-open
|
|
|
|
'' + ''
|
|
|
|
sed '2s#.#\
|
|
|
|
sed() { ${gnused}/bin/sed "$@"; }\
|
|
|
|
grep() { ${gnugrep}/bin/grep "$@"; }\
|
|
|
|
egrep() { ${gnugrep}/bin/egrep "$@"; }\
|
|
|
|
file() { ${file}/bin/file "$@"; }\
|
|
|
|
awk() { ${gawk}/bin/awk "$@"; }\
|
|
|
|
xset() { ${xset}/bin/xset "$@"; }\
|
|
|
|
perl() { PERL5LIB=${perlPath} ${perlPackages.perl}/bin/perl "$@"; }\
|
|
|
|
mimetype() { ${perlPackages.FileMimeInfo}/bin/mimetype "$@"; }\
|
2020-11-19 00:13:47 +00:00
|
|
|
PATH=$PATH:'$out'/bin:${coreutils}/bin\
|
2020-04-24 23:36:52 +00:00
|
|
|
&#' -i "$out"/bin/*
|
|
|
|
|
|
|
|
substituteInPlace $out/bin/xdg-open \
|
2022-12-17 10:02:37 +00:00
|
|
|
--replace "/usr/bin/printf" "${coreutils}/bin/printf" \
|
|
|
|
--replace "gdbus" "${glib}/bin/gdbus"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
substituteInPlace $out/bin/xdg-mime \
|
|
|
|
--replace "/usr/bin/file" "${file}/bin/file"
|
|
|
|
|
|
|
|
substituteInPlace $out/bin/xdg-email \
|
2022-12-17 10:02:37 +00:00
|
|
|
--replace "/bin/echo" "${coreutils}/bin/echo" \
|
|
|
|
--replace "gdbus" "${glib}/bin/gdbus"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-19 00:13:47 +00:00
|
|
|
sed 's|\bwhich\b|type -P|g' -i "$out"/bin/*
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
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.free;
|
|
|
|
maintainers = [ maintainers.eelco ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|