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 Restart = mkForce "on-failure";
36 users.users.calibre-server.home = mkForce stateDir;
40 servers."127.0.0.1:${toString calibre.port}" = {
47 virtualHosts."${srv}.${domain}" = {
51 access_log /var/log/nginx/${domain}/${srv}/access.log json buffer=32k;
52 error_log /var/log/nginx/${domain}/${srv}/error.log;
55 proxyPass = "http://${srv}";
57 client_max_body_size 64m;
62 systemd.services.nginx = {
64 LogsDirectory = lib.mkForce [ "nginx/${domain}/${srv}" ];
67 services.sanoid.datasets."rpool/var/lib/${srv}" = {
68 use_template = [ "snap" ];