diff options
author | Andreas Rammhold <andreas@rammhold.de> | 2021-06-03 15:59:17 +0200 |
---|---|---|
committer | Flakebi <flakebi@t-online.de> | 2021-08-14 10:10:44 +0200 |
commit | 6e1421013a299668fd610dd70b3ebd9105891b90 (patch) | |
tree | cfefc8116b70086d8c80affad70aebe11d3440cd /pkgs/applications/office | |
parent | 95f2dc650d8c6c9f65efd85d915246ab94c4de6e (diff) | |
download | nixpkgs-6e1421013a299668fd610dd70b3ebd9105891b90.tar nixpkgs-6e1421013a299668fd610dd70b3ebd9105891b90.tar.gz nixpkgs-6e1421013a299668fd610dd70b3ebd9105891b90.tar.bz2 nixpkgs-6e1421013a299668fd610dd70b3ebd9105891b90.tar.lz nixpkgs-6e1421013a299668fd610dd70b3ebd9105891b90.tar.xz nixpkgs-6e1421013a299668fd610dd70b3ebd9105891b90.tar.zst nixpkgs-6e1421013a299668fd610dd70b3ebd9105891b90.zip |
paperless: remove package & module as it has been superseded by paperless-ng
The paperless project has moved on to paperless-ng and the original paperless package in Nixpkgs has stopped working recently (due to version incompatibility with the providede Django package). Instead of investing more time into the old module we should migrate all users to the new module instead.
Diffstat (limited to 'pkgs/applications/office')
5 files changed, 0 insertions, 312 deletions
diff --git a/pkgs/applications/office/paperless/default.nix b/pkgs/applications/office/paperless/default.nix deleted file mode 100644 index 74bdacd9584..00000000000 --- a/pkgs/applications/office/paperless/default.nix +++ /dev/null @@ -1,168 +0,0 @@ -{ stdenv -, lib -, fetchFromGitHub -, makeWrapper -, callPackage - -, python3 -, imagemagick -, ghostscript -, optipng -, tesseract -, unpaper -}: - -## Usage - -# ${paperless}/bin/paperless wraps manage.py - -# ${paperless}/share/paperless/setup-env.sh can be sourced from a -# shell script to setup a Paperless environment - -# paperless.withConfig is a convenience function to setup a -# configured Paperless instance. (See ./withConfig.nix) - -# For WSGI with gunicorn, use a shell script like this: -# let -# pythonEnv = paperless.python.withPackages (ps: paperless.runtimePackages ++ [ ps.gunicorn ]); -# in -# writers.writeBash "run-gunicorn" '' -# source ${paperless}/share/paperless/setup-env.sh -# PYTHONPATH=$paperlessSrc ${pythonEnv}/bin/gunicorn paperless.wsgi -# '' - -let - paperless = stdenv.mkDerivation rec { - pname = "paperless"; - version = "2.7.0"; - - src = fetchFromGitHub { - owner = "the-paperless-project"; - repo = "paperless"; - rev = version; - sha256 = "0pkmyky1crjnsg7r0gfk0fadisfsgzlsq6afpz16wx4hp6yvkkf7"; - }; - - nativeBuildInputs = [ makeWrapper ]; - - doCheck = true; - dontInstall = true; - - pythonEnv = python.withPackages (_: runtimePackages); - pythonCheckEnv = python.withPackages (_: (runtimePackages ++ checkPackages)); - - unpackPhase = '' - srcDir=$out/share/paperless - mkdir -p $srcDir - cp -r --no-preserve=mode $src/src/* $src/LICENSE $srcDir - ''; - - postPatch = '' - # django-cors-headers 3.x requires a scheme for allowed hosts - substituteInPlace $out/share/paperless/paperless/settings.py \ - --replace "localhost:8080" "http://localhost:8080" - ''; - - buildPhase = let - # Paperless has explicit runtime checks that expect these binaries to be in PATH - extraBin = lib.makeBinPath [ imagemagick ghostscript optipng tesseract unpaper ]; - in '' - ${python.interpreter} -m compileall $srcDir - - makeWrapper $pythonEnv/bin/python $out/bin/paperless \ - --set PATH ${extraBin} --add-flags $out/share/paperless/manage.py - - # A shell snippet that can be sourced to setup a paperless env - cat > $out/share/paperless/setup-env.sh <<EOF - export PATH="$pythonEnv/bin:${extraBin}''${PATH:+:}$PATH" - export paperlessSrc=$out/share/paperless - EOF - ''; - - checkPhase = '' - source $out/share/paperless/setup-env.sh - tmpDir=$(realpath testsTmp) - mkdir $tmpDir - export HOME=$tmpDir - export PAPERLESS_MEDIADIR=$tmpDir - cd $paperlessSrc - # Prevent tests from writing to the derivation output - chmod -R -w $out - # Disable cache to silence a pytest warning ("could not create cache") - $pythonCheckEnv/bin/pytest -p no:cacheprovider - ''; - - passthru = { - withConfig = callPackage ./withConfig.nix {}; - inherit python runtimePackages checkPackages tesseract; - }; - - meta = with lib; { - description = "Scan, index, and archive all of your paper documents"; - homepage = "https://github.com/the-paperless-project/paperless"; - license = licenses.gpl3; - maintainers = [ maintainers.earvstedt ]; - }; - }; - - python = python3.override { - packageOverrides = self: super: let - customPkgs = import ./python-modules super fetchFromGitHub; in - { - pyocr = pyocrWithUserTesseract super; - - # Paperless is incompatible with factory_boy >= 3 - factory_boy = customPkgs.factory_boy_2_12_0; - - # These are pre-release versions, hence they are private to this pkg - django-filter = self.callPackage ./python-modules/django-filter.nix {}; - django-crispy-forms = self.callPackage ./python-modules/django-crispy-forms.nix {}; - }; - }; - - runtimePackages = with python.pkgs; [ - dateparser - python-dateutil - django - django-cors-headers - django-crispy-forms - django-filter - django_extensions - djangoql - djangorestframework - factory_boy - filemagic - fuzzywuzzy - langdetect - pdftotext - pillow - psycopg2 - pyocr - python-dotenv - python-gnupg - pytz - termcolor - ] ++ (lib.optional stdenv.isLinux inotify-simple); - - checkPackages = with python.pkgs; [ - pytest - pytest-django - pytest-env - pytest-xdist - ]; - - pyocrWithUserTesseract = pyPkgs: - let - pyocr = pyPkgs.pyocr.override { inherit tesseract; }; - in - if pyocr.outPath == pyPkgs.pyocr.outPath then - pyocr - else - # The user has provided a custom tesseract derivation that might be - # missing some languages that are required for PyOCR's tests. Disable them to - # avoid build errors. - pyocr.overridePythonAttrs (attrs: { - doCheck = false; - }); -in - paperless diff --git a/pkgs/applications/office/paperless/python-modules/default.nix b/pkgs/applications/office/paperless/python-modules/default.nix deleted file mode 100644 index e1fb227614f..00000000000 --- a/pkgs/applications/office/paperless/python-modules/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -pyPkgs: fetchFromGitHub: -{ - factory_boy_2_12_0 = pyPkgs.factory_boy.overridePythonAttrs (old: rec { - version = "2.12.0"; - src = pyPkgs.fetchPypi { - inherit (old) pname; - inherit version; - sha256 = "0w53hjgag6ad5i2vmrys8ysk54agsqvgbjy9lg8g0d8pi9h8vx7s"; - }; - }); -} diff --git a/pkgs/applications/office/paperless/python-modules/django-crispy-forms.nix b/pkgs/applications/office/paperless/python-modules/django-crispy-forms.nix deleted file mode 100644 index f8b91a94ccc..00000000000 --- a/pkgs/applications/office/paperless/python-modules/django-crispy-forms.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ lib -, buildPythonPackage -, fetchFromGitHub -, pytestCheckHook -, pytest-django -, django -}: - -buildPythonPackage rec { - pname = "django-crispy-forms"; - version = "1.10.0"; - - src = fetchFromGitHub { - owner = "django-crispy-forms"; - repo = "django-crispy-forms"; - rev = version; - sha256 = "0y6kskfxgckb9npcgwx4zrs5n9px159zh9zhinhxi3i7wlriqpf5"; - }; - - # For reasons unknown, the source dir must contain a dash - # for the tests to run successfully - postUnpack = '' - mv $sourceRoot source- - export sourceRoot=source- - ''; - - checkInputs = [ django pytest-django pytestCheckHook ]; - - preCheck = '' - export DJANGO_SETTINGS_MODULE=crispy_forms.tests.test_settings - ''; - - meta = with lib; { - description = "The best way to have DRY Django forms"; - homepage = "https://github.com/maraujop/django-crispy-forms"; - license = licenses.mit; - maintainers = with maintainers; [ earvstedt ]; - }; -} diff --git a/pkgs/applications/office/paperless/python-modules/django-filter.nix b/pkgs/applications/office/paperless/python-modules/django-filter.nix deleted file mode 100644 index d7f20bd9d37..00000000000 --- a/pkgs/applications/office/paperless/python-modules/django-filter.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ lib, buildPythonPackage, python, pythonOlder, fetchFromGitHub -, django, django-crispy-forms, djangorestframework, mock, pytz }: - -buildPythonPackage rec { - pname = "django-filter"; - version = "2.1.0-pre"; - disabled = pythonOlder "3.4"; - - src = fetchFromGitHub { - owner = "carltongibson"; - repo = pname; - rev = "24adad8c48bc9e7c7539b6510ffde4ce4effdc29"; - sha256 = "0hv4w95jnlzp9vdximl6bb27fyi75001jhvsbs0ikkd8amq8iaj7"; - }; - - checkInputs = [ django django-crispy-forms djangorestframework mock pytz ]; - - checkPhase = "${python.interpreter} runtests.py"; - - meta = with lib; { - description = "A reusable Django application for allowing users to filter querysets dynamically."; - homepage = "https://github.com/carltongibson/django-filter"; - license = licenses.bsd3; - maintainers = with maintainers; [ earvstedt ]; - }; -} diff --git a/pkgs/applications/office/paperless/withConfig.nix b/pkgs/applications/office/paperless/withConfig.nix deleted file mode 100644 index 652d1478c0c..00000000000 --- a/pkgs/applications/office/paperless/withConfig.nix +++ /dev/null @@ -1,68 +0,0 @@ -{ paperless, lib, writers }: - -## Usage -# -# nix-build --out-link ./paperless -E ' -# (import <nixpkgs> {}).paperless.withConfig { -# dataDir = /tmp/paperless-data; -# config = { -# PAPERLESS_DISABLE_LOGIN = "true"; -# }; -# }' -# -# Setup DB -# ./paperless migrate -# -# Consume documents in ${dataDir}/consume -# ./paperless document_consumer --oneshot -# -# Start web interface -# ./paperless runserver --noreload localhost:8000 - -{ config ? {}, dataDir ? null, ocrLanguages ? null -, paperlessPkg ? paperless, extraCmds ? "" }: -with lib; -let - paperless = if ocrLanguages == null then - paperlessPkg - else - (paperlessPkg.override { - tesseract = paperlessPkg.tesseract.override { - enableLanguages = ocrLanguages; - }; - }).overrideDerivation (_: { - # `ocrLanguages` might be missing some languages required by the tests. - doCheck = false; - }); - - envVars = (optionalAttrs (dataDir != null) { - PAPERLESS_CONSUMPTION_DIR = "${dataDir}/consume"; - PAPERLESS_MEDIADIR = "${dataDir}/media"; - PAPERLESS_STATICDIR = "${dataDir}/static"; - PAPERLESS_DBDIR = dataDir; - }) // config; - - envVarDefs = mapAttrsToList (n: v: ''export ${n}="${toString v}"'') envVars; - setupEnvVars = builtins.concatStringsSep "\n" envVarDefs; - - setupEnv = '' - source ${paperless}/share/paperless/setup-env.sh - ${setupEnvVars} - ${optionalString (dataDir != null) '' - mkdir -p "$PAPERLESS_CONSUMPTION_DIR" \ - "$PAPERLESS_MEDIADIR" \ - "$PAPERLESS_STATICDIR" \ - "$PAPERLESS_DBDIR" - ''} - ''; - - runPaperless = writers.writeBash "paperless" '' - set -e - ${setupEnv} - ${extraCmds} - exec python $paperlessSrc/manage.py "$@" - ''; -in - runPaperless // { - inherit paperless setupEnv; - } |