about summary refs log tree commit diff
path: root/pkgs/applications/misc/buku/default.nix
diff options
context:
space:
mode:
authorarcnmx <arcnmx@users.noreply.github.com>2022-01-19 16:50:00 -0800
committerarcnmx <arcnmx@users.noreply.github.com>2022-01-22 10:19:10 -0800
commite14ce3e49a81d93869b47e2c7a72d5ce4d5f6d59 (patch)
tree9df951c0688e331ffad8c0ac0d94b31c4fa3fe62 /pkgs/applications/misc/buku/default.nix
parent4bbd574b2bd8c8ec47871258a3ae149043c1b684 (diff)
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.
Diffstat (limited to 'pkgs/applications/misc/buku/default.nix')
-rw-r--r--pkgs/applications/misc/buku/default.nix39
1 files changed, 23 insertions, 16 deletions
diff --git a/pkgs/applications/misc/buku/default.nix b/pkgs/applications/misc/buku/default.nix
index e8b8714ca2ab5..1be8bc76ba63b 100644
--- a/pkgs/applications/misc/buku/default.nix
+++ b/pkgs/applications/misc/buku/default.nix
@@ -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 ];
   };
 }
-