48 lines
886 B
Nix
48 lines
886 B
Nix
{ lib, config, ... }:
|
|
let
|
|
enabled = config.mod.calibre-web.enable;
|
|
in
|
|
{
|
|
options = {
|
|
mod.calibre-web = {
|
|
enable = lib.mkEnableOption "add calibre-web module";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf enabled {
|
|
services = {
|
|
calibre-web = {
|
|
enable = true;
|
|
|
|
user = "storage";
|
|
group = "storage";
|
|
|
|
listen = {
|
|
ip = "0.0.0.0";
|
|
port = 8083;
|
|
};
|
|
|
|
dataDir = "/mnt/media/public/books";
|
|
|
|
options = {
|
|
calibreLibrary = "/mnt/media/public/books";
|
|
enableBookUploading = true;
|
|
};
|
|
};
|
|
|
|
nginx = {
|
|
virtualHosts."books.ppp.pm" = {
|
|
|
|
extraConfig = ''
|
|
client_max_body_size 1024M;
|
|
'';
|
|
|
|
locations."/" = {
|
|
proxyPass = "http://0.0.0.0:8083"; # TODO add option for port + host
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|