Merge pull request #213489 from mweinelt/paperless-update

paperless-ngx: 1.11.3 -> 1.12.2

Changed files
+113 -34
nixos
modules
services
pkgs
applications
office
paperless-ngx
development
python-modules
redis
+19 -2
nixos/modules/services/misc/paperless.nix
···
# Auto-migrate on first run or if the package has changed
versionFile="${cfg.dataDir}/src-version"
-
if [[ $(cat "$versionFile" 2>/dev/null) != ${pkg} ]]; then
+
version=$(cat "$versionFile" 2>/dev/null || echo 0)
+
+
if [[ $version != ${pkg.version} ]]; then
${pkg}/bin/paperless-ngx migrate
-
echo ${pkg} > "$versionFile"
+
+
# Parse old version string format for backwards compatibility
+
version=$(echo "$version" | grep -ohP '[^-]+$')
+
+
versionLessThan() {
+
target=$1
+
[[ $({ echo "$version"; echo "$target"; } | sort -V | head -1) != "$target" ]]
+
}
+
+
if versionLessThan 1.12.0; then
+
# Reindex documents as mentioned in https://github.com/paperless-ngx/paperless-ngx/releases/tag/v1.12.1
+
echo "Reindexing documents, to allow searching old comments. Required after the 1.12.x upgrade."
+
${pkg}/bin/paperless-ngx document_index reindex
+
fi
+
+
echo ${pkg.version} > "$versionFile"
fi
''
+ optionalString (cfg.passwordFile != null) ''
+93 -31
pkgs/applications/office/paperless-ngx/default.nix
···
{ lib
-
, fetchurl
+
, fetchFromGitHub
+
, buildNpmPackage
, nixosTests
+
, gettext
, python3
, ghostscript
, imagemagickBig
···
, unpaper
, poppler_utils
, liberation_ttf
-
, fetchFromGitHub
}:
let
+
version = "1.12.2";
+
+
src = fetchFromGitHub {
+
owner = "paperless-ngx";
+
repo = "paperless-ngx";
+
rev = "refs/tags/v${version}";
+
hash = "sha256-1QufnRD2Nbc4twRZ4Yrf3ae1BRGves8tJ/M7coWnRPI=";
+
};
+
# Use specific package versions required by paperless-ngx
python = python3.override {
packageOverrides = self: super: {
···
unpaper
poppler_utils
];
+
+
frontend = buildNpmPackage {
+
pname = "paperless-ngx-frontend";
+
inherit version src;
+
+
npmDepsHash = "sha256-fp0Gy3018u2y6jaUM9bmXU0SVjyEJdsvkBqbmb8S10Y=";
+
+
nativeBuildInputs = [
+
python3
+
];
+
+
postPatch = ''
+
cd src-ui
+
'';
+
+
CYPRESS_INSTALL_BINARY = "0";
+
NG_CLI_ANALYTICS = "false";
+
+
npmBuildFlags = [
+
"--" "--configuration" "production"
+
];
+
+
installPhase = ''
+
runHook preInstall
+
mkdir -p $out/lib/paperless-ui
+
mv ../src/documents/static/frontend $out/lib/paperless-ui/
+
runHook postInstall
+
'';
+
};
in
-
python.pkgs.pythonPackages.buildPythonApplication rec {
+
python.pkgs.buildPythonApplication rec {
pname = "paperless-ngx";
-
version = "1.11.3";
+
format = "other";
-
# Fetch the release tarball instead of a git ref because it contains the prebuilt frontend
-
src = fetchurl {
-
url = "https://github.com/paperless-ngx/paperless-ngx/releases/download/v${version}/${pname}-v${version}.tar.xz";
-
hash = "sha256-wGNkdczgV+UDd9ZO+BXMSWotpetE/+c/jJAAH+6SXps=";
-
};
+
inherit version src;
-
format = "other";
+
nativeBuildInputs = [
+
gettext
+
];
-
propagatedBuildInputs = with python.pkgs.pythonPackages; [
+
propagatedBuildInputs = with python.pkgs; [
aioredis
-
arrow
+
amqp
+
anyio
asgiref
async-timeout
attrs
autobahn
automat
+
billiard
bleach
-
blessed
celery
certifi
cffi
channels-redis
channels
-
chardet
+
charset-normalizer
click
+
click-didyoumean
+
click-plugins
+
click-repl
coloredlogs
concurrent-log-handler
constantly
···
django-cors-headers
django-extensions
django-filter
-
django-picklefield
django
djangorestframework
filelock
-
fuzzywuzzy
gunicorn
h11
hiredis
httptools
humanfriendly
+
humanize
hyperlink
-
imagehash
idna
imap-tools
img2pdf
···
langdetect
lxml
msgpack
+
mysqlclient
nltk
numpy
ocrmypdf
+
packaging
pathvalidate
pdf2image
pdfminer-six
···
pillow
pluggy
portalocker
+
prompt-toolkit
psycopg2
pyasn1-modules
pyasn1
···
python-dateutil
python-dotenv
python-gnupg
-
levenshtein
python-magic
pytz
pyyaml
···
scikit-learn
scipy
service-identity
-
six
-
sortedcontainers
+
setproctitle
+
sniffio
sqlparse
threadpoolctl
tika
+
tornado
tqdm
-
twisted.optional-dependencies.tls
+
twisted
txaio
+
tzdata
tzlocal
urllib3
uvicorn
uvloop
+
vine
watchdog
-
watchgod
+
watchfiles
wcwidth
+
webencodings
websockets
whitenoise
whoosh
+
zipp
zope_interface
-
];
+
]
+
++ redis.optional-dependencies.hiredis
+
++ twisted.optional-dependencies.tls
+
++ uvicorn.optional-dependencies.standard;
-
# Compile manually because `pythonRecompileBytecodeHook` only works for
-
# files in `python.sitePackages`
postBuild = ''
+
# Compile manually because `pythonRecompileBytecodeHook` only works
+
# for files in `python.sitePackages`
${python.interpreter} -OO -m compileall src
+
+
# Collect static files
+
${python.interpreter} src/manage.py collectstatic --clear --no-input
+
+
# Compile string translations using gettext
+
${python.interpreter} src/manage.py compilemessages
'';
installPhase = ''
-
mkdir -p $out/lib
-
cp -r . $out/lib/paperless-ngx
+
mkdir -p $out/lib/paperless-ngx
+
cp -r {src,static,LICENSE,gunicorn.conf.py} $out/lib/paperless-ngx
+
ln -s ${frontend}/lib/paperless-ui/frontend $out/lib/paperless-ngx/static/
chmod +x $out/lib/paperless-ngx/src/manage.py
makeWrapper $out/lib/paperless-ngx/src/manage.py $out/bin/paperless-ngx \
--prefix PYTHONPATH : "$PYTHONPATH" \
···
--prefix PATH : "${path}"
'';
-
nativeCheckInputs = with python.pkgs.pythonPackages; [
+
postFixup = ''
+
# Remove tests with samples (~14M)
+
find $out/lib/paperless-ngx -type d -name tests -exec rm -rv {} +
+
'';
+
+
nativeCheckInputs = with python.pkgs; [
+
factory_boy
+
imagehash
pytest-django
pytest-env
-
pytest-sugar
pytest-xdist
-
factory_boy
pytestCheckHook
];
···
];
passthru = {
-
inherit python path;
+
inherit python path frontend;
tests = { inherit (nixosTests) paperless; };
};
meta = with lib; {
description = "Tool to scan, index, and archive all of your physical documents";
homepage = "https://paperless-ngx.readthedocs.io/";
+
changelog = "https://github.com/paperless-ngx/paperless-ngx/releases/tag/v${version}";
license = licenses.gpl3Only;
maintainers = with maintainers; [ lukegb gador erikarvstedt ];
};
+1 -1
pkgs/development/python-modules/redis/default.nix
···
];
passthru.optional-dependencies = {
-
hidredis = [
+
hiredis = [
hiredis
];
ocsp = [