mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
fix(mediabox): mediatomb
This commit is contained in:
parent
1d038633ce
commit
ef5306904c
9 changed files with 61 additions and 17 deletions
|
|
@ -5,8 +5,9 @@
|
|||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkIf mkDefault mkOptionDefault;
|
||||
inherit (config.services) nginx;
|
||||
cfg = config.services.plex;
|
||||
access = config.services.nginx.access.plex;
|
||||
access = nginx.access.plex;
|
||||
in {
|
||||
options.services.nginx.access.plex = with lib.types; {
|
||||
url = mkOption {
|
||||
|
|
@ -20,10 +21,14 @@ in {
|
|||
type = str;
|
||||
default = "plex.local.${config.networking.domain}";
|
||||
};
|
||||
externalPort = mkOption {
|
||||
type = nullOr port;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
config.services.nginx = {
|
||||
access.plex = mkIf cfg.enable {
|
||||
url = mkOptionDefault "http://localhost:32400";
|
||||
url = mkOptionDefault "http://localhost:${toString cfg.port}";
|
||||
};
|
||||
virtualHosts = let
|
||||
extraConfig = ''
|
||||
|
|
@ -62,6 +67,19 @@ in {
|
|||
kTLS = mkDefault true;
|
||||
inherit extraConfig;
|
||||
};
|
||||
plex-external = mkIf (access.externalPort != null) {
|
||||
serverName = mkDefault access.domain;
|
||||
default = mkDefault true;
|
||||
listen = map (addr: {
|
||||
inherit addr;
|
||||
port = access.externalPort;
|
||||
}) nginx.defaultListenAddresses;
|
||||
locations."/" = location;
|
||||
inherit extraConfig;
|
||||
};
|
||||
};
|
||||
};
|
||||
config.networking.firewall.allowedTCPPorts = mkIf (access.externalPort != null) [
|
||||
access.externalPort
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue