dotfiles/nix/modules/nixos/features/homelab/audiobookshelf.nix

31 lines
626 B
Nix
Raw Normal View History

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 {
services.audiobookshelf = {
enable = true;
2024-12-26 21:35:05 +00:00
host = "audiobookshelf.oliverdavies.uk";
2024-12-26 00:13:42 +00:00
port = 4001;
};
2024-12-14 20:19:42 +00:00
2024-12-26 00:13:42 +00:00
services.nginx = {
enable = true;
2024-12-14 20:19:42 +00:00
2024-12-26 21:35:05 +00:00
virtualHosts."audiobookshelf.oliverdavies.uk" = {
2024-12-26 00:13:42 +00:00
locations."/" = {
proxyPass = "http://localhost:${toString config.services.audiobookshelf.port}/";
proxyWebsockets = true;
};
2024-12-14 20:19:42 +00:00
};
};
};
}