18 # Use specific package versions required by paperless-ngx
19 python = python3.override {
20 packageOverrides = self: super: {
21 django = super.django_4;
23 # use paperless-ngx version of django-q
24 # see https://github.com/paperless-ngx/paperless-ngx/pull/1014
25 django-q = super.django-q.overridePythonAttrs (oldAttrs: {
26 src = fetchFromGitHub {
27 owner = "paperless-ngx";
29 hash = "sha256-alu7tZwUn77xhUF9c/aGmwRwO//mR/FucXjvXUl/6ek=";
30 rev = "8b5289d8caf36f67fb99448e76ead20d5b498c1b";
32 # due to paperless-ngx modification of the pyproject.toml file
33 # the patch is not needed any more
37 aioredis = super.aioredis.overridePythonAttrs (oldAttrs: rec {
39 src = oldAttrs.src.override {
41 sha256 = "0fi7jd5hlx8cnv1m97kv9hc4ih4l8v15wzkqwsp73is4n0qazy0m";
45 # downgrade redis due to https://github.com/paperless-ngx/paperless-ngx/pull/1802
46 # and https://github.com/django/channels_redis/issues/332
47 channels-redis = super.channels-redis.overridePythonAttrs (oldAttrs: rec {
49 src = fetchFromGitHub {
51 repo = "channels_redis";
53 hash = "sha256-ZQSsE3pkM+nfDhWutNuupcyC5MDikUu6zU4u7Im6bRQ=";
57 channels = super.channels.overridePythonAttrs (oldAttrs: rec {
60 src = fetchFromGitHub {
64 sha256 = "sha256-bKrPLbD9zG7DwIYBst1cb+zkDsM8B02wh3D80iortpw=";
66 propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [ self.daphne ];
69 daphne = super.daphne.overridePythonAttrs (oldAttrs: rec {
72 src = fetchFromGitHub {
76 hash = "sha256-KWkMV4L7bA2Eo/u4GGif6lmDNrZAzvYyDiyzyWt9LeI=";
82 path = lib.makeBinPath [
93 python.pkgs.pythonPackages.buildPythonApplication rec {
94 pname = "paperless-ngx";
97 # Fetch the release tarball instead of a git ref because it contains the prebuilt fontend
99 url = "https://github.com/paperless-ngx/paperless-ngx/releases/download/v${version}/${pname}-v${version}.tar.xz";
100 hash = "sha256-fafjVXRfzFrINzI/Ivfm1VY4YpemHkHwThBP54XoXM4=";
105 propagatedBuildInputs = with python.pkgs.pythonPackages; [
121 concurrent-log-handler
186 twisted.optional-dependencies.tls
201 # paperless-ngx includes the bundled django-q version. This will
202 # conflict with the tests and is not needed since we overrode the
203 # django-q version with the paperless-ngx version
208 # Compile manually because `pythonRecompileBytecodeHook` only works for
209 # files in `python.sitePackages`
211 ${python.interpreter} -OO -m compileall src
216 cp -r . $out/lib/paperless-ngx
217 chmod +x $out/lib/paperless-ngx/src/manage.py
218 makeWrapper $out/lib/paperless-ngx/src/manage.py $out/bin/paperless-ngx \
219 --prefix PYTHONPATH : "$PYTHONPATH" \
220 --prefix PATH : "${path}"
223 checkInputs = with python.pkgs.pythonPackages; [
237 # - PATH with runtime binaries
238 # - A temporary HOME directory for gnupg
239 # - XDG_DATA_DIRS with test-specific fonts
241 export PATH="${path}:$PATH"
242 export HOME=$(mktemp -d)
243 export XDG_DATA_DIRS="${liberation_ttf}/share:$XDG_DATA_DIRS"
245 # Disable unneeded code coverage test
246 substituteInPlace src/setup.cfg \
247 --replace "--cov --cov-report=html" ""
253 tests = { inherit (nixosTests) paperless; };
257 description = "Tool to scan, index, and archive all of your physical documents";
258 homepage = "https://paperless-ngx.readthedocs.io/";
259 license = licenses.gpl3Only;
260 maintainers = with maintainers; [ lukegb gador erikarvstedt ];