nixos/hosts/architect/calibre.nix

41 lines
977 B
Nix
Raw Normal View History

{ config, lib, ... }:
2022-04-05 13:04:53 +01:00
let
domain = "books.giugl.io";
2022-11-22 11:59:27 +00:00
auth_block = (import ./openid.nix { inherit lib; }).openresty_oidc_block;
utilities = import ./utilities.nix { inherit lib config; };
inherit (utilities) architectInterfaceAddress;
2022-11-22 11:59:27 +00:00
in
{
2022-04-05 13:04:53 +01:00
services = {
calibre-web = {
enable = true;
group = "media";
options = {
enableBookConversion = true;
enableBookUploading = true;
};
};
nginx.virtualHosts.${domain} = {
forceSSL = true;
enableACME = true;
2022-04-05 13:04:53 +01:00
locations."/" = {
proxyPass = "http://127.0.0.1:8083";
2022-04-05 13:04:53 +01:00
extraConfig = ''
client_max_body_size 500M;
2022-11-22 11:59:27 +00:00
'' + auth_block { access_role = "calibre"; };
2022-04-05 13:04:53 +01:00
};
};
};
networking.extraHosts = ''
${architectInterfaceAddress "lan"} ${domain}
${architectInterfaceAddress "wireguard"} ${domain}
${architectInterfaceAddress "tailscale"} ${domain}
2022-04-05 13:04:53 +01:00
'';
users.groups.media.members = [ "calibre-web" ];
}