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

36 lines
723 B
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.nixosModules.homelab;
service = "audiobookshelf";
in
2024-12-14 20:19:42 +00:00
{
2025-04-30 01:10:02 +01:00
options.nixosModules.homelab.services.${service} = {
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
};
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 cfg.port}";
recommendedProxySettings = true;
};
};
2024-12-14 20:19:42 +00:00
};
};
}