nixpkgs/pkgs/applications/office/paperwork/paperwork-gtk.nix

107 lines
2.6 KiB
Nix
Raw Normal View History

{ lib
, python3Packages
, gtk3
, cairo
, gnome3
, librsvg
, xvfb_run
, dbus
, libnotify
, wrapGAppsHook
2020-10-31 12:00:00 +00:00
, fetchFromGitLab
, which
, gettext
, gobject-introspection
}:
python3Packages.buildPythonApplication rec {
2020-10-31 12:00:00 +00:00
inherit (import ./src.nix { inherit fetchFromGitLab; }) version src;
pname = "paperwork";
2018-09-14 13:32:02 +01:00
sourceRoot = "source/paperwork-gtk";
# Patch out a few paths that assume that we're using the FHS:
postPatch = ''
2020-10-31 12:00:00 +00:00
chmod a+w -R ..
patchShebangs ../tools
2020-10-31 12:00:00 +00:00
export HOME=$(mktemp -d)
2020-10-31 12:00:00 +00:00
cat - ../AUTHORS.py > src/paperwork_gtk/_version.py <<EOF
2018-09-14 13:32:02 +01:00
# -*- coding: utf-8 -*-
version = "${version}"
authors_code=""
EOF
'';
2020-10-31 12:00:00 +00:00
preBuild = ''
make l10n_compile
'';
postInstall = ''
# paperwork-shell needs to be re-wrapped with access to paperwork
2020-10-31 12:00:00 +00:00
cp ${python3Packages.paperwork-shell}/bin/.paperwork-cli-wrapped $out/bin/paperwork-cli
# install desktop files and icons
2020-10-31 12:00:00 +00:00
XDG_DATA_HOME=$out/share $out/bin/paperwork-gtk install --user
2021-01-02 12:00:00 +00:00
# fixes [WARNING] [openpaperwork_core.resources.setuptools] Failed to find
# resource file paperwork_gtk.icon.out/paperwork_128.png, tried at path
# /nix/store/3n5lz6y8k9yks76f0nar3smc8djan3xr-paperwork-2.0.2/lib/python3.8/site-packages/paperwork_gtk/icon/out/paperwork_128.png.
site=$out/lib/${python3Packages.python.libPrefix}/site-packages/paperwork_gtk
for i in $site/data/paperwork_*.png; do
ln -s $i $site/icon/out;
done
'';
2020-10-31 12:00:00 +00:00
checkInputs = [ xvfb_run dbus.daemon ];
nativeBuildInputs = [
wrapGAppsHook
2020-10-31 12:00:00 +00:00
gobject-introspection
(lib.getBin gettext)
which
];
buildInputs = [
gnome3.adwaita-icon-theme
libnotify
librsvg
2020-10-31 12:00:00 +00:00
gtk3
cairo
];
2020-10-31 12:00:00 +00:00
dontWrapGApps = true;
preFixup = ''
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
'';
# 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 \
2020-10-31 12:00:00 +00:00
$out/bin/paperwork-gtk chkdeps
'';
propagatedBuildInputs = with python3Packages; [
paperwork-backend
2020-10-31 12:00:00 +00:00
paperwork-shell
openpaperwork-gtk
openpaperwork-core
pypillowfight
pyxdg
dateutil
setuptools
];
meta = {
description = "A personal document manager for scanned documents";
homepage = "https://openpaper.work/";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ aszlig symphorien ];
platforms = lib.platforms.linux;
};
}