1 { pkgs, lib, config, ... }:
4 domain = "sourcephile.fr";
6 calibre = config.services.calibre-server;
7 stateDir = "/var/lib/calibre";
10 # Beware, calibre pulls a lot of dependencies..
11 # TODO: The calibre server also supports systemd socket activation
12 services.calibre-server = {
17 "${stateDir}/libraries/julm"
19 # sudo -u calibre-server calibre-server --userdb /var/lib/calibre/users.sqlite --manage-users
23 userDb = "${stateDir}/users.sqlite";
26 systemd.services.calibre-server = {
29 StartLimitIntervalSec = "600s";
32 MemoryAccounting = true;
35 Restart = mkForce "on-failure";
39 users.users.calibre-server.home = mkForce stateDir;
43 servers."127.0.0.1:${toString calibre.port}" = {
50 virtualHosts."${srv}.${domain}" = {
54 access_log /var/log/nginx/${domain}/${srv}/access.log json buffer=32k;
55 error_log /var/log/nginx/${domain}/${srv}/error.log;
58 proxyPass = "http://${srv}";
60 client_max_body_size 64m;
65 systemd.services.nginx = {
67 LogsDirectory = lib.mkForce [ "nginx/${domain}/${srv}" ];
70 services.sanoid.datasets."rpool/var/lib/${srv}" = {
71 use_template = [ "snap" ];