btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / un / unoconv / package.nix
blob81e97d1a13fdec678c77d50071714883e6dc049c
1 { lib, stdenv, fetchFromGitHub, libreoffice-unwrapped, asciidoc, makeWrapper
2 # whether to install odt2pdf/odt2doc/... symlinks to unoconv
3 , installSymlinks ? true
4 }:
6 stdenv.mkDerivation rec {
7   pname = "unoconv";
8   version = "0.9.0";
10   src = fetchFromGitHub {
11     owner = "unoconv";
12     repo = "unoconv";
13     rev = version;
14     sha256 = "1akx64686in8j8arl6vsgp2n3bv770q48pfv283c6fz6wf9p8fvr";
15   };
17   nativeBuildInputs = [ asciidoc makeWrapper ];
19   preBuild = ''
20     makeFlags=prefix="$out"
21   '';
23   postInstall = ''
24     sed -i "s|/usr/bin/env python.*|${libreoffice-unwrapped.python.interpreter}|" "$out/bin/unoconv"
25     wrapProgram "$out/bin/unoconv" \
26         --set-default UNO_PATH "${libreoffice-unwrapped}/lib/libreoffice/program/"
27   '' + lib.optionalString installSymlinks ''
28     make install-links prefix="$out"
29   '';
31   meta = with lib; {
32     description = "Convert between any document format supported by LibreOffice/OpenOffice";
33     homepage = "http://dag.wieers.com/home-made/unoconv/";
34     license = licenses.gpl2Only;
35     platforms = platforms.linux;
36     maintainers = [ maintainers.bjornfor ];
37     mainProgram = "unoconv";
38   };