···
···
22
+
src = fetchFromGitHub {
23
+
owner = "paperless-ngx";
24
+
repo = "paperless-ngx";
25
+
rev = "refs/tags/v${version}";
26
+
hash = "sha256-1QufnRD2Nbc4twRZ4Yrf3ae1BRGves8tJ/M7coWnRPI=";
# Use specific package versions required by paperless-ngx
python = python3.override {
packageOverrides = self: super: {
···
92
+
frontend = buildNpmPackage {
93
+
pname = "paperless-ngx-frontend";
94
+
inherit version src;
96
+
npmDepsHash = "sha256-fp0Gy3018u2y6jaUM9bmXU0SVjyEJdsvkBqbmb8S10Y=";
98
+
nativeBuildInputs = [
106
+
CYPRESS_INSTALL_BINARY = "0";
107
+
NG_CLI_ANALYTICS = "false";
110
+
"--" "--configuration" "production"
115
+
mkdir -p $out/lib/paperless-ui
116
+
mv ../src/documents/static/frontend $out/lib/paperless-ui/
117
+
runHook postInstall
82
-
python.pkgs.pythonPackages.buildPythonApplication rec {
121
+
python.pkgs.buildPythonApplication rec {
86
-
# Fetch the release tarball instead of a git ref because it contains the prebuilt frontend
88
-
url = "https://github.com/paperless-ngx/paperless-ngx/releases/download/v${version}/${pname}-v${version}.tar.xz";
89
-
hash = "sha256-wGNkdczgV+UDd9ZO+BXMSWotpetE/+c/jJAAH+6SXps=";
125
+
inherit version src;
127
+
nativeBuildInputs = [
94
-
propagatedBuildInputs = with python.pkgs.pythonPackages; [
131
+
propagatedBuildInputs = with python.pkgs; [
···
···
···
···
···
180
-
twisted.optional-dependencies.tls
240
+
++ redis.optional-dependencies.hiredis
241
+
++ twisted.optional-dependencies.tls
242
+
++ uvicorn.optional-dependencies.standard;
195
-
# Compile manually because `pythonRecompileBytecodeHook` only works for
196
-
# files in `python.sitePackages`
245
+
# Compile manually because `pythonRecompileBytecodeHook` only works
246
+
# for files in `python.sitePackages`
${python.interpreter} -OO -m compileall src
249
+
# Collect static files
250
+
${python.interpreter} src/manage.py collectstatic --clear --no-input
252
+
# Compile string translations using gettext
253
+
${python.interpreter} src/manage.py compilemessages
203
-
cp -r . $out/lib/paperless-ngx
257
+
mkdir -p $out/lib/paperless-ngx
258
+
cp -r {src,static,LICENSE,gunicorn.conf.py} $out/lib/paperless-ngx
259
+
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}"
213
-
nativeCheckInputs = with python.pkgs.pythonPackages; [
270
+
# Remove tests with samples (~14M)
271
+
find $out/lib/paperless-ngx -type d -name tests -exec rm -rv {} +
274
+
nativeCheckInputs = with python.pkgs; [
···
253
-
inherit python path;
314
+
inherit python path frontend;
tests = { inherit (nixosTests) paperless; };
description = "Tool to scan, index, and archive all of your physical documents";
homepage = "https://paperless-ngx.readthedocs.io/";
321
+
changelog = "https://github.com/paperless-ngx/paperless-ngx/releases/tag/v${version}";
license = licenses.gpl3Only;
maintainers = with maintainers; [ lukegb gador erikarvstedt ];