Add calibre and remove dead kavita guts

Calibre and Kavita are both services to read books, we are switching
away from Kavita due to its non-support of single-sign-on

Calibre only supports arbitrary single-sign-on via a header, but we can
use oauth2-proxy to connect it with keycloak anyway. This will be done
in a followup change

Change-Id: I3cb5940d86095299d3e8d3e8cfb94470daf48db4
Reviewed-on: https://git.clicks.codes/c/Clicks/NixFiles/+/202
Tested-by: Skyler Grey <minion@clicks.codes>
Reviewed-by: Samuel Shuert <coded@clicks.codes>
diff --git a/modules/common/calibre.nix b/modules/common/calibre.nix
new file mode 100644
index 0000000..c11d0a8
--- /dev/null
+++ b/modules/common/calibre.nix
@@ -0,0 +1,37 @@
+{config, ...}: {
+
+  users.users.calibre-server.extraGroups = [ "nextcloud" ];
+  users.users.calibre-web.extraGroups = [ "nextcloud" ];
+
+  services.calibre-server = {
+    enable = true;
+
+    host = "127.0.0.255";
+    port = 1033;
+
+    libraries = [
+      "${config.services.nextcloud.datadir}/data/clicks-services/files/calibre"
+    ];
+
+  };
+
+  services.calibre-web = {
+    enable = true;
+    listen = {
+      ip = "127.0.0.255";
+      port = 1032;
+    };
+
+    options = {
+      enableBookUploading = true;
+      enableBookConversion = true;
+
+      calibreLibrary = "${config.services.nextcloud.datadir}/data/clicks-services/files/calibre";
+
+      reverseProxyAuth = {
+        enable = false;
+        header = "keycloak_oidc";
+      }; # TODO: setup keycloak auth with oauth2_proxy
+    };
+  };
+}
\ No newline at end of file