nixpkgs/pkgs/tools/X11/xdg-utils/default.nix

63 lines
1.9 KiB
Nix
Raw Normal View History

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 = "8e0070f17bcd3612ee83cb84e663e7c7fabcca3d";
sha256 = "15gw2nyrqmdsdin8gzxihpn77grhk9l97jp7s7pr7sl4n9ya2rpj";
2015-08-15 19:01:46 +00:00
};
in
stdenv.mkDerivation rec {
2016-03-20 00:50:05 +00:00
name = "xdg-utils-${version}";
2017-08-27 02:11:38 +00:00
version = "1.1.2";
2016-03-20 00:50:05 +00:00
src = fetchurl {
url = "https://portland.freedesktop.org/download/${name}.tar.gz";
2017-08-27 02:11:38 +00:00
sha256 = "1k4b4m3aiyqn9k12a0ihcdahzlspl3zhskmm1d7228dvqvi546cm";
};
# just needed when built from git
buildInputs = [ libxslt docbook_xml_dtd_412 docbook_xsl xmlto w3m ];
2015-08-15 19:01:46 +00:00
postInstall = stdenv.lib.optionalString mimiSupport ''
cp ${mimisrc}/xdg-open $out/bin/xdg-open
2017-06-05 23:37:35 +00: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 "$@"; }\
&#' -i "$out"/bin/*
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"
2017-08-27 02:11:38 +00:00
substituteInPlace $out/bin/xdg-email \
--replace "/bin/echo" "${coreutils}/bin/echo"
sed 's# which # type -P #g' -i "$out"/bin/*
'';
2015-08-15 19:01:46 +00:00
meta = with stdenv.lib; {
2018-02-22 08:08:28 +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";
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;
};
}