2021-02-22 11:10:46 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
2021-02-23 11:23:20 +00:00
|
|
|
, nixosTests
|
2021-02-22 11:10:46 +00:00
|
|
|
, python3
|
2023-05-25 16:06:38 +00:00
|
|
|
, fetchPypi
|
2021-02-22 11:10:46 +00:00
|
|
|
}:
|
|
|
|
|
2023-03-12 18:35:52 +00:00
|
|
|
let
|
|
|
|
python = python3.override {
|
|
|
|
packageOverrides = self: super: {
|
|
|
|
sqlalchemy = super.sqlalchemy.overridePythonAttrs (old: rec {
|
|
|
|
version = "1.4.46";
|
2023-05-25 16:06:38 +00:00
|
|
|
src = fetchPypi {
|
2023-03-12 18:35:52 +00:00
|
|
|
pname = "SQLAlchemy";
|
|
|
|
inherit version;
|
|
|
|
hash = "sha256-aRO4JH2KKS74MVFipRkx4rQM6RaB8bbxj2lwRSAMSjA=";
|
|
|
|
};
|
2023-07-21 15:03:19 +00:00
|
|
|
disabledTestPaths = [
|
|
|
|
"test/aaa_profiling"
|
|
|
|
"test/ext/mypy"
|
|
|
|
];
|
2023-03-12 18:35:52 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
python.pkgs.buildPythonApplication rec {
|
2021-02-22 11:10:46 +00:00
|
|
|
pname = "calibre-web";
|
2023-04-25 23:42:17 +00:00
|
|
|
version = "0.6.20";
|
2021-02-22 11:10:46 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "janeczku";
|
|
|
|
repo = "calibre-web";
|
|
|
|
rev = version;
|
2023-04-25 23:42:17 +00:00
|
|
|
hash = "sha256-0lArY1aTpO4sgIVDSqClYMGlip92f9hE/L2UouTLK8Q=";
|
2021-02-22 11:10:46 +00:00
|
|
|
};
|
|
|
|
|
2023-03-12 18:35:52 +00:00
|
|
|
propagatedBuildInputs = with python.pkgs; [
|
2023-02-19 16:15:19 +00:00
|
|
|
apscheduler
|
2022-04-30 09:42:32 +00:00
|
|
|
advocate
|
2022-06-08 11:17:54 +00:00
|
|
|
chardet
|
2022-01-12 15:09:31 +00:00
|
|
|
flask-babel
|
2022-10-21 05:56:36 +00:00
|
|
|
flask-login
|
2023-08-23 13:56:30 +00:00
|
|
|
flask-principal
|
2022-05-24 04:09:51 +00:00
|
|
|
flask-wtf
|
2023-04-25 23:42:17 +00:00
|
|
|
flask-limiter
|
2022-01-12 15:09:31 +00:00
|
|
|
iso-639
|
2023-08-26 13:31:22 +00:00
|
|
|
jsonschema
|
2022-01-12 15:09:31 +00:00
|
|
|
lxml
|
2023-04-25 23:42:17 +00:00
|
|
|
pypdf
|
2022-01-12 15:09:31 +00:00
|
|
|
requests
|
|
|
|
sqlalchemy
|
|
|
|
tornado
|
|
|
|
unidecode
|
2022-11-14 03:27:14 +00:00
|
|
|
wand
|
2022-04-30 09:42:32 +00:00
|
|
|
werkzeug
|
2022-01-12 15:09:31 +00:00
|
|
|
];
|
|
|
|
|
2021-02-22 11:10:46 +00:00
|
|
|
patches = [
|
|
|
|
# default-logger.patch switches default logger to /dev/stdout. Otherwise calibre-web tries to open a file relative
|
|
|
|
# to its location, which can't be done as the store is read-only. Log file location can later be configured using UI
|
|
|
|
# if needed.
|
|
|
|
./default-logger.patch
|
|
|
|
# DB migrations adds an env var __RUN_MIGRATIONS_ANDEXIT that, when set, instructs calibre-web to run DB migrations
|
|
|
|
# and exit. This is gonna be used to configure calibre-web declaratively, as most of its configuration parameters
|
|
|
|
# are stored in the DB.
|
|
|
|
./db-migrations.patch
|
2023-09-06 02:47:06 +00:00
|
|
|
# environ in tornado.wsgi.WSGIContainer no longer a static method from 6.3 version
|
|
|
|
./static_environ.patch
|
2021-02-22 11:10:46 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# calibre-web doesn't follow setuptools directory structure. The following is taken from the script
|
|
|
|
# that calibre-web's maintainer is using to package it:
|
|
|
|
# https://github.com/OzzieIsaacs/calibre-web-test/blob/master/build/make_release.py
|
|
|
|
postPatch = ''
|
|
|
|
mkdir -p src/calibreweb
|
|
|
|
mv cps.py src/calibreweb/__init__.py
|
|
|
|
mv cps src/calibreweb
|
2021-11-02 12:47:56 +00:00
|
|
|
|
2022-11-28 13:46:56 +00:00
|
|
|
sed -i "/backports_abc/d" setup.cfg
|
|
|
|
|
2021-11-02 12:47:56 +00:00
|
|
|
substituteInPlace setup.cfg \
|
|
|
|
--replace "cps = calibreweb:main" "calibre-web = calibreweb:main" \
|
2023-03-12 18:35:52 +00:00
|
|
|
--replace "APScheduler>=3.6.3,<3.10.0" "APScheduler>=3.6.3" \
|
2022-07-18 17:45:35 +00:00
|
|
|
--replace "chardet>=3.0.0,<4.1.0" "chardet>=3.0.0,<6" \
|
2022-04-25 20:25:37 +00:00
|
|
|
--replace "Flask>=1.0.2,<2.1.0" "Flask>=1.0.2" \
|
2023-04-25 23:42:17 +00:00
|
|
|
--replace "Flask-Babel>=0.11.1,<3.1.0" "Flask-Babel>=0.11.1" \
|
2022-10-15 11:25:26 +00:00
|
|
|
--replace "Flask-Login>=0.3.2,<0.6.2" "Flask-Login>=0.3.2" \
|
2022-04-30 09:42:32 +00:00
|
|
|
--replace "flask-wtf>=0.14.2,<1.1.0" "flask-wtf>=0.14.2" \
|
|
|
|
--replace "lxml>=3.8.0,<4.9.0" "lxml>=3.8.0" \
|
2022-07-18 17:45:35 +00:00
|
|
|
--replace "tornado>=4.1,<6.2" "tornado>=4.1,<7" \
|
2023-04-25 23:42:17 +00:00
|
|
|
--replace "PyPDF>=3.0.0,<3.6.0" "PyPDF>=3.0.0" \
|
2023-05-18 15:52:08 +00:00
|
|
|
--replace "requests>=2.11.1,<2.29.0" "requests" \
|
2022-04-30 09:42:32 +00:00
|
|
|
--replace "unidecode>=0.04.19,<1.4.0" "unidecode>=0.04.19" \
|
|
|
|
--replace "werkzeug<2.1.0" ""
|
2021-02-22 11:10:46 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# Upstream repo doesn't provide any tests.
|
|
|
|
doCheck = false;
|
|
|
|
|
2021-02-23 11:23:20 +00:00
|
|
|
passthru.tests.calibre-web = nixosTests.calibre-web;
|
|
|
|
|
2021-02-22 11:10:46 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Web app for browsing, reading and downloading eBooks stored in a Calibre database";
|
|
|
|
homepage = "https://github.com/janeczku/calibre-web";
|
|
|
|
license = licenses.gpl3Plus;
|
2022-01-12 15:09:31 +00:00
|
|
|
maintainers = with maintainers; [ pborzenkov ];
|
2021-02-22 11:10:46 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|