2020-03-07 13:20:42 +01:00
|
|
|
{ lib
|
|
|
|
, python3Packages
|
|
|
|
, gtk3
|
|
|
|
, cairo
|
2021-05-07 23:18:14 +02:00
|
|
|
, gnome
|
2020-03-07 13:20:42 +01:00
|
|
|
, librsvg
|
2021-05-08 15:45:03 +02:00
|
|
|
, xvfb-run
|
2020-03-07 13:20:42 +01:00
|
|
|
, dbus
|
|
|
|
, libnotify
|
|
|
|
, wrapGAppsHook
|
2020-10-31 13:00:00 +01:00
|
|
|
, fetchFromGitLab
|
|
|
|
, which
|
|
|
|
, gettext
|
|
|
|
, gobject-introspection
|
2021-05-09 14:00:00 +02:00
|
|
|
, gdk-pixbuf
|
2021-03-04 21:12:42 +01:00
|
|
|
, texlive
|
|
|
|
, imagemagick
|
|
|
|
, perlPackages
|
2022-02-03 13:00:00 +01:00
|
|
|
, writeScript
|
2016-12-19 22:06:48 +01:00
|
|
|
}:
|
|
|
|
|
2021-03-04 21:12:42 +01:00
|
|
|
let
|
|
|
|
documentation_deps = [
|
|
|
|
(texlive.combine {
|
2023-01-21 13:00:00 +01:00
|
|
|
inherit (texlive) scheme-small wrapfig gensymb;
|
2021-03-04 21:12:42 +01:00
|
|
|
})
|
|
|
|
xvfb-run
|
|
|
|
imagemagick
|
|
|
|
perlPackages.Po4a
|
|
|
|
];
|
2022-02-03 13:00:00 +01:00
|
|
|
inherit (import ./src.nix { inherit fetchFromGitLab; }) version src sample_documents;
|
2021-03-04 21:12:42 +01:00
|
|
|
in
|
|
|
|
|
2016-12-19 22:06:48 +01:00
|
|
|
python3Packages.buildPythonApplication rec {
|
2022-02-03 13:00:00 +01:00
|
|
|
inherit src version;
|
2019-02-15 10:08:27 +01:00
|
|
|
pname = "paperwork";
|
2023-03-04 13:00:00 +01:00
|
|
|
format = "pyproject";
|
2016-12-19 22:06:48 +01:00
|
|
|
|
2022-02-03 13:00:00 +01:00
|
|
|
sample_docs = sample_documents // {
|
|
|
|
# a trick for the update script
|
|
|
|
name = "sample_documents";
|
|
|
|
src = sample_documents;
|
|
|
|
};
|
|
|
|
|
2023-07-25 15:27:31 +02:00
|
|
|
sourceRoot = "${src.name}/paperwork-gtk";
|
2016-12-19 22:06:48 +01:00
|
|
|
|
2023-03-04 13:00:00 +01:00
|
|
|
env.SETUPTOOLS_SCM_PRETEND_VERSION = version;
|
2023-01-20 22:35:30 +01:00
|
|
|
|
2023-03-04 13:00:00 +01:00
|
|
|
postPatch = ''
|
2020-10-31 13:00:00 +01:00
|
|
|
chmod a+w -R ..
|
|
|
|
patchShebangs ../tools
|
2016-12-19 22:06:48 +01:00
|
|
|
|
2020-10-31 13:00:00 +01:00
|
|
|
export HOME=$(mktemp -d)
|
2016-12-19 22:06:48 +01:00
|
|
|
'';
|
|
|
|
|
2020-10-31 13:00:00 +01:00
|
|
|
preBuild = ''
|
|
|
|
make l10n_compile
|
|
|
|
'';
|
|
|
|
|
2020-03-07 13:20:42 +01:00
|
|
|
postInstall = ''
|
|
|
|
# paperwork-shell needs to be re-wrapped with access to paperwork
|
2023-06-05 14:00:00 +02:00
|
|
|
for exe in paperwork-cli paperwork-json; do
|
|
|
|
cp ${python3Packages.paperwork-shell}/bin/.$exe-wrapped $out/bin/$exe
|
|
|
|
done
|
2020-03-07 13:20:42 +01:00
|
|
|
# install desktop files and icons
|
2020-10-31 13:00:00 +01:00
|
|
|
XDG_DATA_HOME=$out/share $out/bin/paperwork-gtk install --user
|
2021-01-02 13:00:00 +01: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
|
2021-03-04 21:12:42 +01:00
|
|
|
|
|
|
|
export XDG_DATA_DIRS=$XDG_DATA_DIRS:${gnome.adwaita-icon-theme}/share
|
|
|
|
# build the user manual
|
2022-02-03 13:00:00 +01:00
|
|
|
PATH=$out/bin:$PATH PAPERWORK_TEST_DOCUMENTS=${sample_docs} make data
|
2021-03-04 21:12:42 +01:00
|
|
|
for i in src/paperwork_gtk/model/help/out/*.pdf; do
|
|
|
|
install -Dt $site/model/help/out $i
|
|
|
|
done
|
2020-03-07 13:20:42 +01:00
|
|
|
'';
|
|
|
|
|
2023-01-21 13:00:00 +01:00
|
|
|
nativeCheckInputs = [ dbus ];
|
2020-03-07 13:20:42 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
wrapGAppsHook
|
2020-10-31 13:00:00 +01:00
|
|
|
gobject-introspection
|
2023-03-04 13:00:00 +01:00
|
|
|
python3Packages.setuptools-scm
|
2020-10-31 13:00:00 +01:00
|
|
|
(lib.getBin gettext)
|
|
|
|
which
|
2021-05-09 14:00:00 +02:00
|
|
|
gdk-pixbuf # for the setup hook
|
2021-03-04 21:12:42 +01:00
|
|
|
] ++ documentation_deps;
|
2020-03-07 13:20:42 +01:00
|
|
|
|
2017-11-09 07:08:56 +01:00
|
|
|
buildInputs = [
|
2021-05-07 23:18:14 +02:00
|
|
|
gnome.adwaita-icon-theme
|
2020-03-07 13:20:42 +01:00
|
|
|
libnotify
|
|
|
|
librsvg
|
2020-10-31 13:00:00 +01:00
|
|
|
gtk3
|
|
|
|
cairo
|
2017-11-09 07:08:56 +01:00
|
|
|
];
|
2016-12-19 22:06:48 +01:00
|
|
|
|
2020-10-31 13:00:00 +01:00
|
|
|
dontWrapGApps = true;
|
|
|
|
|
|
|
|
preFixup = ''
|
|
|
|
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
|
|
|
|
'';
|
|
|
|
|
2021-03-04 21:12:42 +01:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
# 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.
|
2016-12-19 22:06:48 +01:00
|
|
|
xvfb-run -s '-screen 0 800x600x24' dbus-run-session \
|
2022-11-21 03:03:50 +01:00
|
|
|
--config-file=${dbus}/share/dbus-1/session.conf \
|
2020-10-31 13:00:00 +01:00
|
|
|
$out/bin/paperwork-gtk chkdeps
|
2021-03-04 21:12:42 +01:00
|
|
|
|
2023-06-05 14:00:00 +02:00
|
|
|
$out/bin/paperwork-cli chkdeps
|
|
|
|
$out/bin/paperwork-json chkdeps
|
|
|
|
|
2021-03-04 21:12:42 +01:00
|
|
|
# content of make test, without the dep on make install
|
|
|
|
python -m unittest discover --verbose -s tests
|
|
|
|
|
|
|
|
runHook postCheck
|
2016-12-19 22:06:48 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = with python3Packages; [
|
2020-03-07 13:20:42 +01:00
|
|
|
paperwork-backend
|
2020-10-31 13:00:00 +01:00
|
|
|
paperwork-shell
|
|
|
|
openpaperwork-gtk
|
|
|
|
openpaperwork-core
|
2020-03-07 13:20:42 +01:00
|
|
|
pypillowfight
|
|
|
|
pyxdg
|
|
|
|
setuptools
|
2016-12-19 22:06:48 +01:00
|
|
|
];
|
|
|
|
|
2021-03-04 21:12:42 +01:00
|
|
|
disallowedRequisites = documentation_deps;
|
|
|
|
|
2022-02-03 13:00:00 +01:00
|
|
|
passthru.updateScript = writeScript "update.sh" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl common-updater-scripts
|
2022-04-23 21:16:41 +02:00
|
|
|
version=$(list-git-tags | sed 's/^v//' | sort -V | tail -n1)
|
2022-02-03 13:00:00 +01:00
|
|
|
update-source-version paperwork "$version" --file=pkgs/applications/office/paperwork/src.nix
|
|
|
|
docs_version="$(curl https://gitlab.gnome.org/World/OpenPaperwork/paperwork/-/raw/$version/paperwork-gtk/src/paperwork_gtk/model/help/screenshot.sh | grep TEST_DOCS_TAG= | cut -d'"' -f2)"
|
|
|
|
update-source-version paperwork.sample_docs "$docs_version" --file=pkgs/applications/office/paperwork/src.nix --version-key=rev
|
|
|
|
'';
|
|
|
|
|
2016-12-19 22:06:48 +01:00
|
|
|
meta = {
|
|
|
|
description = "A personal document manager for scanned documents";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://openpaper.work/";
|
2016-12-19 22:06:48 +01:00
|
|
|
license = lib.licenses.gpl3Plus;
|
2020-03-07 13:20:42 +01:00
|
|
|
maintainers = with lib.maintainers; [ aszlig symphorien ];
|
2016-12-19 22:06:48 +01:00
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
};
|
|
|
|
}
|