32 lines
1.1 KiB
Nix
32 lines
1.1 KiB
Nix
{ lib, config, proxy, ... }: {
|
|
options.my.servers.audiobookshelf.enable = lib.mkEnableOption "enable";
|
|
config = lib.mkIf config.my.servers.audiobookshelf.enable {
|
|
services = {
|
|
audiobookshelf = {
|
|
enable = true;
|
|
group = "piracy";
|
|
port = 5687;
|
|
};
|
|
nginx = {
|
|
enable = true;
|
|
virtualHosts."audiobooks.${config.my.domain}" = proxy {
|
|
"/" = {
|
|
proxyPass = "http://${config.my.localhost}:${
|
|
toString config.services.audiobookshelf.port
|
|
}";
|
|
extraConfig = ''
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_http_version 1.1;
|
|
proxy_redirect http:// https://;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|