2016-03-20 00:50:05 +00:00
|
|
|
{ stdenv, fetchurl, fetchFromGitHub
|
|
|
|
, file, libxslt, docbook_xml_dtd_412, docbook_xsl, xmlto
|
2015-08-15 19:01:46 +00:00
|
|
|
, w3m, which, gnugrep, gnused, coreutils
|
|
|
|
, mimiSupport ? false, gawk ? null }:
|
|
|
|
|
|
|
|
assert mimiSupport -> gawk != null;
|
|
|
|
|
|
|
|
let
|
|
|
|
# A much better xdg-open
|
|
|
|
mimisrc = fetchFromGitHub {
|
|
|
|
owner = "march-linux";
|
|
|
|
repo = "mimi";
|
|
|
|
rev = "d85ea8256ed627e93b387cd42e4ab39bfab9504c";
|
|
|
|
sha256 = "1h9mb3glfvc6pa2f9g07xgmf8lrwxiyjxvl906xlysy4klybxvhg";
|
|
|
|
};
|
|
|
|
in
|
2010-03-25 19:48:06 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2016-03-20 00:50:05 +00:00
|
|
|
name = "xdg-utils-${version}";
|
|
|
|
version = "1.1.1";
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2016-03-20 00:50:05 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://portland.freedesktop.org/download/${name}.tar.gz";
|
|
|
|
sha256 = "09a1pk3ifsndc5qz2kcd1557i137gpgnv3d739pv22vfayi67pdh";
|
2010-03-25 19:48:06 +00:00
|
|
|
};
|
2012-10-04 11:38:26 +00:00
|
|
|
|
2015-02-07 06:30:05 +00:00
|
|
|
# just needed when built from git
|
|
|
|
buildInputs = [ libxslt docbook_xml_dtd_412 docbook_xsl xmlto w3m ];
|
2015-01-25 13:30:27 +00:00
|
|
|
|
2015-08-15 19:01:46 +00:00
|
|
|
postInstall = stdenv.lib.optionalString mimiSupport ''
|
|
|
|
cp ${mimisrc}/xdg-open $out/bin/xdg-open
|
2016-03-14 09:57:08 +00:00
|
|
|
''
|
|
|
|
+ ''
|
|
|
|
for tool in "${coreutils}/bin/cut" "${gnused}/bin/sed" \
|
|
|
|
"${gnugrep}"/bin/{e,}grep "${file}/bin/file" \
|
|
|
|
${stdenv.lib.optionalString mimiSupport
|
|
|
|
'' "${gawk}/bin/awk" "${coreutils}/bin/sort" ''} ;
|
|
|
|
do
|
|
|
|
sed "s# $(basename "$tool") # $tool #g" -i "$out"/bin/*
|
2015-06-18 08:51:35 +00:00
|
|
|
done
|
2016-03-14 09:57:08 +00:00
|
|
|
|
2016-03-20 00:50:39 +00: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"
|
|
|
|
|
2016-03-14 09:57:08 +00:00
|
|
|
sed 's# which # type -P #g' -i "$out"/bin/*
|
2012-10-04 11:38:26 +00:00
|
|
|
'';
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2015-08-15 19:01:46 +00:00
|
|
|
meta = with stdenv.lib; {
|
2010-03-25 19:48:06 +00:00
|
|
|
homepage = http://portland.freedesktop.org/wiki/;
|
|
|
|
description = "A set of command line tools that assist applications with a variety of desktop integration tasks";
|
2015-08-15 19:01:46 +00:00
|
|
|
license = if mimiSupport then licenses.gpl2 else licenses.free;
|
|
|
|
maintainers = [ maintainers.eelco ];
|
2015-10-28 17:49:04 +00:00
|
|
|
platforms = platforms.all;
|
2010-03-25 19:48:06 +00:00
|
|
|
};
|
|
|
|
}
|