summary refs log tree commit diff
path: root/pkgs/applications/office
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2016-12-19 22:06:48 +0100
committeraszlig <aszlig@redmoonstudios.org>2016-12-19 22:25:56 +0100
commit7199f1bd9470f6acabcfadddef50d4934727796e (patch)
tree226368c482bf1920fd52e4fa132c79217f518416 /pkgs/applications/office
parentd331f58b900710164e1681a9d32fa7d75662935e (diff)
downloadnixlib-7199f1bd9470f6acabcfadddef50d4934727796e.tar
nixlib-7199f1bd9470f6acabcfadddef50d4934727796e.tar.gz
nixlib-7199f1bd9470f6acabcfadddef50d4934727796e.tar.bz2
nixlib-7199f1bd9470f6acabcfadddef50d4934727796e.tar.lz
nixlib-7199f1bd9470f6acabcfadddef50d4934727796e.tar.xz
nixlib-7199f1bd9470f6acabcfadddef50d4934727796e.tar.zst
nixlib-7199f1bd9470f6acabcfadddef50d4934727796e.zip
paperwork: init at 1.0.6.1
I have not yet tested scanning, but the main application works so far.

A lot of patching is required here, because the upstream project
references some paths from well-known FHS locations which of course are
not available on Nix(OS).

We also use all available aspell dictionaries right now, which is maybe
a bit ugly but it makes language switching easier.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/applications/office')
-rw-r--r--pkgs/applications/office/paperwork/default.nix78
1 files changed, 78 insertions, 0 deletions
diff --git a/pkgs/applications/office/paperwork/default.nix b/pkgs/applications/office/paperwork/default.nix
new file mode 100644
index 000000000000..2c55be55b08b
--- /dev/null
+++ b/pkgs/applications/office/paperwork/default.nix
@@ -0,0 +1,78 @@
+{ lib, python3Packages, fetchFromGitHub, gtk3, cairo
+, aspellDicts, buildEnv
+, gnome3, hicolor_icon_theme
+, xvfb_run, dbus
+}:
+
+python3Packages.buildPythonApplication rec {
+  name = "paperwork-${version}";
+  # Don't forget to also update paperwork-backend when updating this!
+  version = "1.0.6.1";
+
+  src = fetchFromGitHub {
+    repo = "paperwork";
+    owner = "jflesch";
+    rev = version;
+    sha256 = "1v1lxyi4crdik4jlwjds9n6lzw4m4l4f9n5azlinv8wb477qpv6h";
+  };
+
+  # Patch out a few paths that assume that we're using the FHS:
+  postPatch = ''
+    themeDir="$(echo "${gnome3.defaultIconTheme}/share/icons/"*)"
+    sed -i -e "s,/usr/share/icons/gnome,$themeDir," src/paperwork/deps.py
+
+    sed -i -e 's,sys\.prefix,"",g' \
+      src/paperwork/frontend/aboutdialog/__init__.py \
+      src/paperwork/frontend/mainwindow/__init__.py \
+      setup.py
+
+    sed -i -e '/^UI_FILES_DIRS = \[/,/^\]$/ {
+      c UI_FILES_DIRS = ["'"$out/share/paperwork"'"]
+    }' src/paperwork/frontend/util/__init__.py
+
+    sed -i -e '/^LOCALE_PATHS = \[/,/^\]$/ {
+      c LOCALE_PATHS = ["'"$out/share/locale"'"]
+    }' src/paperwork/paperwork.py
+
+    sed -i -e 's/"icon"/"icon-name"/g' \
+      src/paperwork/frontend/mainwindow/mainwindow.glade
+
+    sed -i -e 's/"logo"/"logo-icon-name"/g' \
+      src/paperwork/frontend/aboutdialog/aboutdialog.glade
+  '';
+
+  ASPELL_CONF = "dict-dir ${buildEnv {
+    name = "aspell-all-dicts";
+    paths = lib.collect lib.isDerivation aspellDicts;
+  }}/lib/aspell";
+
+  checkInputs = [ xvfb_run dbus.daemon ];
+  buildInputs = [ gnome3.defaultIconTheme hicolor_icon_theme ];
+
+  # A few parts of chkdeps need to have a display and a dbus session, so we not
+  # only need to run a virtual X server + dbus but also have a large enough
+  # resolution, because the Cairo test tries to draw a 200x200 window.
+  preCheck = ''
+    xvfb-run -s '-screen 0 800x600x24' dbus-run-session \
+      --config-file=${dbus.daemon}/share/dbus-1/session.conf \
+      paperwork-shell chkdeps paperwork
+  '';
+
+  propagatedBuildInputs = with python3Packages; [
+    paperwork-backend pypillowfight gtk3 cairo
+  ];
+
+  makeWrapperArgs = [
+    "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\""
+    "--prefix XDG_DATA_DIRS : \"$out/share\""
+    "--suffix XDG_DATA_DIRS : \"$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH\""
+  ];
+
+  meta = {
+    description = "A personal document manager for scanned documents";
+    homepage = "https://github.com/jflesch/paperwork";
+    license = lib.licenses.gpl3Plus;
+    maintainers = [ lib.maintainers.aszlig ];
+    platforms = lib.platforms.linux;
+  };
+}