homepage: audiobookshelf init

This commit is contained in:
2024-07-05 20:46:50 -06:00
parent 96e5a4b8ca
commit 8d70d160cf
5 changed files with 72 additions and 11 deletions

View File

@@ -1,19 +1,20 @@
{ lib, config, proxy, ... }: {
options.my.servers.audiobookshelf.enable = lib.mkEnableOption "enable";
{ lib, config, proxy, setup, ... }:
let cfg = config.my.servers.audiobookshelf;
in {
options.my.servers.audiobookshelf =
setup.mkServerOptions "audiobookshelf" "audiobooks" 5687;
config = lib.mkIf config.my.servers.audiobookshelf.enable {
services = {
audiobookshelf = {
enable = true;
group = "piracy";
port = 5687;
port = cfg.port;
};
nginx = {
enable = true;
virtualHosts."audiobooks.${config.my.domain}" = proxy {
virtualHosts."${cfg.host}" = proxy {
"/" = {
proxyPass = "http://${config.my.localhost}:${
toString config.services.audiobookshelf.port
}";
proxyPass = cfg.local;
extraConfig = ''
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;