2024-12-26 00:13:42 +00:00
|
|
|
{ config, lib, ... }:
|
2024-12-14 20:19:42 +00:00
|
|
|
|
2024-12-26 00:13:42 +00:00
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.features.homelab.audiobookshelf;
|
|
|
|
in
|
2024-12-14 20:19:42 +00:00
|
|
|
{
|
2024-12-26 00:13:42 +00:00
|
|
|
options.features.homelab.audiobookshelf.enable = mkEnableOption "Enable audiobookshelf";
|
2024-12-14 20:19:42 +00:00
|
|
|
|
2024-12-26 00:13:42 +00:00
|
|
|
config = mkIf cfg.enable {
|
2025-01-01 14:45:03 +00:00
|
|
|
services = {
|
|
|
|
audiobookshelf = {
|
|
|
|
enable = true;
|
2024-12-26 00:13:42 +00:00
|
|
|
|
2025-01-01 14:45:03 +00:00
|
|
|
port = 4001;
|
|
|
|
};
|
2024-12-14 20:19:42 +00:00
|
|
|
|
2025-01-01 14:45:03 +00:00
|
|
|
caddy.virtualHosts."audiobookshelf.opdavies.uk" = {
|
|
|
|
useACMEHost = "opdavies.uk";
|
2024-12-14 20:19:42 +00:00
|
|
|
|
2025-01-01 14:45:03 +00:00
|
|
|
extraConfig = "reverse_proxy localhost:${toString config.services.audiobookshelf.port}";
|
2024-12-14 20:19:42 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|