buku: make bukuserver optional

bukuserver (an optional web GUI frontend for buku) depends on a large
number of flask packages, which break in nixpkgs very often.
This commit is contained in:
arcnmx 2022-01-19 16:50:00 -08:00
parent 4bbd574b2b
commit e14ce3e49a

View File

@ -1,4 +1,4 @@
{ lib, python3, fetchFromGitHub }:
{ lib, python3, fetchFromGitHub, withServer ? false }:
let
python3' = python3.override {
@ -19,6 +19,21 @@ let
});
};
};
serverRequire = with python3'.pkgs; [
requests
flask
flask-admin
flask-api
flask-bootstrap
flask-paginate
flask-reverse-proxy-fix
flask_wtf
arrow
werkzeug
click
vcrpy
toml
];
in
with python3'.pkgs; buildPythonApplication rec {
version = "4.6";
@ -40,27 +55,16 @@ with python3'.pkgs; buildPythonApplication rec {
flake8
pyyaml
mypy-extensions
click
];
propagatedBuildInputs = [
cryptography
beautifulsoup4
requests
certifi
urllib3
flask
flask-admin
flask-api
flask-bootstrap
flask-paginate
flask-reverse-proxy-fix
flask_wtf
arrow
werkzeug
click
html5lib
vcrpy
toml
];
] ++ lib.optionals withServer serverRequire;
postPatch = ''
# Jailbreak problematic dependencies
@ -80,6 +84,8 @@ with python3'.pkgs; buildPythonApplication rec {
--replace "self.assertEqual(url, \"https://www.google.com\")" ""
substituteInPlace setup.py \
--replace mypy-extensions==0.4.1 mypy-extensions>=0.4.1
'' + lib.optionalString (!withServer) ''
rm tests/test_{server,views}.py
'';
postInstall = ''
@ -89,6 +95,8 @@ with python3'.pkgs; buildPythonApplication rec {
cp auto-completion/zsh/* $out/share/zsh/site-functions
cp auto-completion/bash/* $out/share/bash-completion/completions
cp auto-completion/fish/* $out/share/fish/vendor_completions.d
'' + lib.optionalString (!withServer) ''
rm $out/bin/bukuserver
'';
meta = with lib; {
@ -99,4 +107,3 @@ with python3'.pkgs; buildPythonApplication rec {
maintainers = with maintainers; [ matthiasbeyer infinisil ma27 ];
};
}