1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/tools/misc/txt2man/default.nix

44 lines
1.3 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, coreutils, gawk }:
stdenv.mkDerivation rec {
pname = "txt2man";
2020-07-02 22:05:21 +01:00
version = "1.7.1";
src = fetchurl {
url = "https://github.com/mvertes/txt2man/archive/${pname}-${version}.tar.gz";
2020-07-02 22:05:21 +01:00
sha256 = "0ka3krmblsprv0v6h6wnm8lv08w30z0ynfnbwns6alks5gx1p6sd";
};
preConfigure = ''
makeFlags=prefix="$out"
'';
patchPhase = ''
for f in bookman src2man txt2man; do
substituteInPlace $f --replace "gawk" "${gawk}/bin/gawk"
substituteInPlace $f --replace "(date" "(${coreutils}/bin/date"
substituteInPlace $f --replace "=cat" "=${coreutils}/bin/cat"
substituteInPlace $f --replace "cat <<" "${coreutils}/bin/cat <<"
substituteInPlace $f --replace "expand" "${coreutils}/bin/expand"
substituteInPlace $f --replace "(uname" "(${coreutils}/bin/uname"
done
'';
doCheck = true;
checkPhase = ''
# gawk and coreutils are part of stdenv but will not
# necessarily be in PATH at runtime.
sh -c 'unset PATH; printf hello | ./txt2man'
'';
meta = {
description = "Convert flat ASCII text to man page format";
homepage = "http://mvertes.free.fr/";
license = stdenv.lib.licenses.gpl2;
platforms = with stdenv.lib.platforms; linux ++ darwin;
maintainers = with stdenv.lib.maintainers; [ bjornfor ];
};
}