summary refs log tree commit diff
path: root/pkgs/tools/text/unoconv/default.nix
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2013-09-01 20:30:23 +0200
committerBjørn Forsman <bjorn.forsman@gmail.com>2013-09-02 07:11:58 +0200
commitb7d4c94d52c9f6b1381d7a34adea1e8f93f13360 (patch)
tree6cdd59af042f19a5be08dfe4086d668296b30666 /pkgs/tools/text/unoconv/default.nix
parentc56e869d959ed9392f8bc980f3bbd153cda670fa (diff)
downloadnixpkgs-b7d4c94d52c9f6b1381d7a34adea1e8f93f13360.tar
nixpkgs-b7d4c94d52c9f6b1381d7a34adea1e8f93f13360.tar.gz
nixpkgs-b7d4c94d52c9f6b1381d7a34adea1e8f93f13360.tar.bz2
nixpkgs-b7d4c94d52c9f6b1381d7a34adea1e8f93f13360.tar.lz
nixpkgs-b7d4c94d52c9f6b1381d7a34adea1e8f93f13360.tar.xz
nixpkgs-b7d4c94d52c9f6b1381d7a34adea1e8f93f13360.tar.zst
nixpkgs-b7d4c94d52c9f6b1381d7a34adea1e8f93f13360.zip
unoconv: new package
unoconv is a tool that converts between any document format supported by
LibreOffice/OpenOffice.

Example of how to convert an .odt file to .pdf:
  unoconv -f pdf some-file.odt

Homepage: http://dag.wieers.com/home-made/unoconv/

Implementation notes:
unoconv must use the same python version as libreoffice (unless it will
not be able to load the pyuno module from libreoffice). And because we
recently switched to libreoffice 4.x, which uses python3, I had to
include unoconv-python3.patch. The patch comes from upstream unoconv.git
repo, so it will be included in the next release.
Diffstat (limited to 'pkgs/tools/text/unoconv/default.nix')
-rw-r--r--pkgs/tools/text/unoconv/default.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/pkgs/tools/text/unoconv/default.nix b/pkgs/tools/text/unoconv/default.nix
new file mode 100644
index 00000000000..ac90cb556f9
--- /dev/null
+++ b/pkgs/tools/text/unoconv/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, python3, libreoffice, asciidoc, makeWrapper
+# whether to install odt2pdf/odt2doc/... symlinks to unoconv
+, installSymlinks ? true
+}:
+
+# IMPORTANT: unoconv must use the same python version as libreoffice (unless it
+# will not be able to load the pyuno module from libreoffice).
+
+stdenv.mkDerivation rec {
+  name = "unoconv-0.6";
+
+  src = fetchurl {
+    url = "http://dag.wieers.com/home-made/unoconv/${name}.tar.gz";
+    sha256 = "1m3kv942zf5rzyrbkil0nhmyq9mm3007y64bb3s7w88mhr5n23kr";
+  };
+
+  buildInputs = [ asciidoc makeWrapper ];
+
+  # We need to use python3 because libreoffice 4.x uses it. This patch comes
+  # from unoconv.git, so it will be a part of the next release.
+  patches = [ ./unoconv-python3.patch ];
+
+  preBuild = ''
+    makeFlags=prefix="$out"
+  '';
+
+  postInstall = ''
+    sed -i "s|/usr/bin/env python.*|${python3}/bin/${python3.executable}|" "$out/bin/unoconv"
+    wrapProgram "$out/bin/unoconv" --set UNO_PATH "${libreoffice}/lib/libreoffice/program/"
+  '' + (if installSymlinks then ''
+    make install-links prefix="$out"
+  '' else "");
+
+  meta = with stdenv.lib; {
+    description = "Convert between any document format supported by LibreOffice/OpenOffice";
+    homepage = http://dag.wieers.com/home-made/unoconv/;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}