nix-config/hosts/nixedo/modules/audiobookshelf.nix

56 lines
1.1 KiB
Nix
Raw Normal View History

2025-04-30 01:10:02 +01:00
{ config, lib, ... }:
with lib;
2024-12-14 20:19:42 +00:00
let
2025-04-30 01:10:02 +01:00
cfg = homelab.services.${service};
homelab = config.features.homelab;
2025-04-30 01:10:02 +01:00
service = "audiobookshelf";
in
2024-12-14 20:19:42 +00:00
{
options.features.homelab.services.${service} = {
2025-04-30 01:10:02 +01:00
enable = mkEnableOption "Enable ${service}";
2024-12-26 00:13:42 +00:00
2025-04-30 01:10:02 +01:00
url = mkOption {
default = "audiobookshelf.${homelab.baseDomain}";
type = types.str;
2025-04-19 11:45:23 +01:00
};
homepage.name = mkOption {
default = "Audiobookshelf";
type = types.str;
};
homepage.description = mkOption {
default = "Self-hosted audiobook and podcast server";
type = types.str;
};
homepage.icon = mkOption {
default = "audiobookshelf";
type = types.str;
};
homepage.category = mkOption {
default = "Media";
type = types.str;
};
2025-04-30 01:10:02 +01:00
};
config = mkIf cfg.enable {
services = {
${service}.enable = true;
2024-12-14 20:19:42 +00:00
2025-04-30 01:10:02 +01:00
nginx.virtualHosts.${cfg.url} = {
forceSSL = true;
useACMEHost = homelab.baseDomain;
2024-12-14 20:19:42 +00:00
2025-04-30 01:10:02 +01:00
locations."/" = {
proxyPass = "http://localhost:${toString config.services.${service}.port}";
2025-04-30 01:10:02 +01:00
recommendedProxySettings = true;
};
};
2024-12-14 20:19:42 +00:00
};
};
}