2016-03-20 01:50:05 +01:00
|
|
|
{ stdenv, fetchurl, fetchFromGitHub
|
|
|
|
, file, libxslt, docbook_xml_dtd_412, docbook_xsl, xmlto
|
2019-09-24 22:07:47 +02:00
|
|
|
, w3m, gnugrep, gnused, coreutils, xset, perlPackages
|
2015-08-15 21:01:46 +02:00
|
|
|
, mimiSupport ? false, gawk ? null }:
|
|
|
|
|
|
|
|
assert mimiSupport -> gawk != null;
|
|
|
|
|
|
|
|
let
|
|
|
|
# A much better xdg-open
|
|
|
|
mimisrc = fetchFromGitHub {
|
|
|
|
owner = "march-linux";
|
|
|
|
repo = "mimi";
|
2017-01-04 15:01:35 +01:00
|
|
|
rev = "8e0070f17bcd3612ee83cb84e663e7c7fabcca3d";
|
|
|
|
sha256 = "15gw2nyrqmdsdin8gzxihpn77grhk9l97jp7s7pr7sl4n9ya2rpj";
|
2015-08-15 21:01:46 +02:00
|
|
|
};
|
2019-09-24 22:07:47 +02:00
|
|
|
|
|
|
|
perlPath = with perlPackages; makePerlPath [
|
|
|
|
NetDBus XMLTwig XMLParser X11Protocol
|
|
|
|
];
|
|
|
|
|
2015-08-15 21:01:46 +02:00
|
|
|
in
|
2010-03-25 20:48:06 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "xdg-utils";
|
2018-10-10 23:35:09 +02:00
|
|
|
version = "1.1.3";
|
2014-11-06 01:44:33 +01:00
|
|
|
|
2016-03-20 01:50:05 +01:00
|
|
|
src = fetchurl {
|
2019-08-15 14:41:18 +02:00
|
|
|
url = "https://portland.freedesktop.org/download/${pname}-${version}.tar.gz";
|
2018-10-10 23:35:09 +02:00
|
|
|
sha256 = "1nai806smz3zcb2l5iny4x7li0fak0rzmjg6vlyhdqm8z25b166p";
|
2010-03-25 20:48:06 +01:00
|
|
|
};
|
2012-10-04 13:38:26 +02:00
|
|
|
|
2015-02-07 07:30:05 +01:00
|
|
|
# just needed when built from git
|
|
|
|
buildInputs = [ libxslt docbook_xml_dtd_412 docbook_xsl xmlto w3m ];
|
2015-01-25 14:30:27 +01:00
|
|
|
|
2015-08-15 21:01:46 +02:00
|
|
|
postInstall = stdenv.lib.optionalString mimiSupport ''
|
|
|
|
cp ${mimisrc}/xdg-open $out/bin/xdg-open
|
2017-06-06 01:37:35 +02:00
|
|
|
'' + ''
|
|
|
|
sed '2s#.#\
|
|
|
|
cut() { ${coreutils}/bin/cut "$@"; }\
|
|
|
|
sed() { ${gnused}/bin/sed "$@"; }\
|
|
|
|
grep() { ${gnugrep}/bin/grep "$@"; }\
|
|
|
|
egrep() { ${gnugrep}/bin/egrep "$@"; }\
|
|
|
|
file() { ${file}/bin/file "$@"; }\
|
|
|
|
awk() { ${gawk}/bin/awk "$@"; }\
|
|
|
|
sort() { ${coreutils}/bin/sort "$@"; }\
|
2018-03-20 20:15:56 +01:00
|
|
|
xset() { ${xset}/bin/xset "$@"; }\
|
2019-09-24 22:07:47 +02:00
|
|
|
perl() { PERL5LIB=${perlPath} ${perlPackages.perl}/bin/perl "$@"; }\
|
2019-11-01 15:31:59 +01:00
|
|
|
mimetype() { ${perlPackages.FileMimeInfo}/bin/mimetype "$@"; }\
|
2020-06-17 14:27:55 +02:00
|
|
|
PATH=$PATH:'"$out"'/bin\
|
2017-06-06 01:37:35 +02:00
|
|
|
&#' -i "$out"/bin/*
|
2016-03-14 10:57:08 +01:00
|
|
|
|
2016-03-20 01:50:39 +01:00
|
|
|
substituteInPlace $out/bin/xdg-open \
|
|
|
|
--replace "/usr/bin/printf" "${coreutils}/bin/printf"
|
|
|
|
|
|
|
|
substituteInPlace $out/bin/xdg-mime \
|
|
|
|
--replace "/usr/bin/file" "${file}/bin/file"
|
|
|
|
|
2017-08-27 04:11:38 +02:00
|
|
|
substituteInPlace $out/bin/xdg-email \
|
|
|
|
--replace "/bin/echo" "${coreutils}/bin/echo"
|
|
|
|
|
2016-03-14 10:57:08 +01:00
|
|
|
sed 's# which # type -P #g' -i "$out"/bin/*
|
2012-10-04 13:38:26 +02:00
|
|
|
'';
|
2014-11-06 01:44:33 +01:00
|
|
|
|
2015-08-15 21:01:46 +02:00
|
|
|
meta = with stdenv.lib; {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://www.freedesktop.org/wiki/Software/xdg-utils/";
|
2010-03-25 20:48:06 +01:00
|
|
|
description = "A set of command line tools that assist applications with a variety of desktop integration tasks";
|
2015-08-15 21:01:46 +02:00
|
|
|
license = if mimiSupport then licenses.gpl2 else licenses.free;
|
|
|
|
maintainers = [ maintainers.eelco ];
|
2015-10-28 18:49:04 +01:00
|
|
|
platforms = platforms.all;
|
2010-03-25 20:48:06 +01:00
|
|
|
};
|
|
|
|
}
|