mirror of
https://github.com/tuxdotrs/nix-config.git
synced 2026-09-19 16:49:04 +05:30
feat(services): add pangolin proxy configuration
This commit is contained in:
@@ -57,6 +57,7 @@
|
|||||||
vaultwarden = {
|
vaultwarden = {
|
||||||
enable = true;
|
enable = true;
|
||||||
domain = "bw.lab.tux.rs";
|
domain = "bw.lab.tux.rs";
|
||||||
|
configurePangolin = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,12 @@
|
|||||||
description = "Whether to configure Nginx as a reverse proxy for AIOStreams";
|
description = "Whether to configure Nginx as a reverse proxy for AIOStreams";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
configurePangolin = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether to configure Pangolin as a reverse proxy for AIOStreams";
|
||||||
|
};
|
||||||
|
|
||||||
image = mkOption {
|
image = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "ghcr.io/viren070/aiostreams:latest";
|
default = "ghcr.io/viren070/aiostreams:latest";
|
||||||
@@ -81,12 +87,39 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
services.nginx.virtualHosts.${cfg.domain} = mkIf cfg.configureNginx {
|
services = {
|
||||||
forceSSL = acmeHost != "";
|
nginx.virtualHosts.${cfg.domain} = mkIf cfg.configureNginx {
|
||||||
useACMEHost = mkIf (acmeHost != "") acmeHost;
|
forceSSL = acmeHost != "";
|
||||||
locations."/" = {
|
useACMEHost = mkIf (acmeHost != "") acmeHost;
|
||||||
proxyPass = "http://${cfg.host}:${port}";
|
locations."/" = {
|
||||||
proxyWebsockets = true;
|
proxyPass = "http://${cfg.host}:${port}";
|
||||||
|
proxyWebsockets = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
newt.blueprint.proxy-resources = mkIf cfg.configurePangolin {
|
||||||
|
aiostreams = {
|
||||||
|
auth = {
|
||||||
|
sso-enabled = false;
|
||||||
|
};
|
||||||
|
full-domain = cfg.domain;
|
||||||
|
name = "aiostreams";
|
||||||
|
protocol = "http";
|
||||||
|
targets = [
|
||||||
|
{
|
||||||
|
hostname = "localhost";
|
||||||
|
method = "http";
|
||||||
|
port = cfg.port;
|
||||||
|
healthcheck = {
|
||||||
|
hostname = "localhost";
|
||||||
|
port = cfg.port;
|
||||||
|
scheme = "http";
|
||||||
|
method = "GET";
|
||||||
|
path = "/";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,6 +39,12 @@
|
|||||||
description = "Whether to configure Nginx as a reverse proxy for MediaFlow Proxy";
|
description = "Whether to configure Nginx as a reverse proxy for MediaFlow Proxy";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
configurePangolin = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether to configure Pangolin as a reverse proxy for MediaFlow Proxy";
|
||||||
|
};
|
||||||
|
|
||||||
image = mkOption {
|
image = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "ghcr.io/mhdzumair/mediaflow-proxy-light:latest";
|
default = "ghcr.io/mhdzumair/mediaflow-proxy-light:latest";
|
||||||
@@ -56,7 +62,11 @@
|
|||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = !cfg.configureNginx || cfg.domain != "";
|
assertion = !cfg.configureNginx || cfg.domain != "";
|
||||||
message = "tnix.services.mediaflow-proxy.domain must be set when configureNginx is enabled.";
|
message = "tnix.services.mediaflow-proxy.domain must be set when tnix.services.mediaflow-proxy.configureNginx is enabled.";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
assertion = !cfg.configurePangolin || cfg.domain != "";
|
||||||
|
message = "tnix.services.mediaflow-proxy.domain must be set when tnix.services.mediaflow-proxy.configurePangolin is enabled.";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -72,12 +82,39 @@
|
|||||||
environmentFiles = optional (cfg.environmentFile != null) cfg.environmentFile;
|
environmentFiles = optional (cfg.environmentFile != null) cfg.environmentFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
services.nginx.virtualHosts.${cfg.domain} = mkIf cfg.configureNginx {
|
services = {
|
||||||
forceSSL = acmeHost != "";
|
nginx.virtualHosts.${cfg.domain} = mkIf cfg.configureNginx {
|
||||||
useACMEHost = mkIf (acmeHost != "") acmeHost;
|
forceSSL = acmeHost != "";
|
||||||
locations."/" = {
|
useACMEHost = mkIf (acmeHost != "") acmeHost;
|
||||||
proxyPass = "http://${cfg.host}:${port}";
|
locations."/" = {
|
||||||
proxyWebsockets = true;
|
proxyPass = "http://${cfg.host}:${port}";
|
||||||
|
proxyWebsockets = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
newt.blueprint.proxy-resources = mkIf cfg.configurePangolin {
|
||||||
|
mediaflow-proxy = {
|
||||||
|
auth = {
|
||||||
|
sso-enabled = false;
|
||||||
|
};
|
||||||
|
full-domain = cfg.domain;
|
||||||
|
name = "mediaflow-proxy";
|
||||||
|
protocol = "http";
|
||||||
|
targets = [
|
||||||
|
{
|
||||||
|
hostname = "localhost";
|
||||||
|
method = "http";
|
||||||
|
port = cfg.port;
|
||||||
|
healthcheck = {
|
||||||
|
hostname = "localhost";
|
||||||
|
port = cfg.port;
|
||||||
|
scheme = "http";
|
||||||
|
method = "GET";
|
||||||
|
path = "/";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,6 +38,12 @@
|
|||||||
default = false;
|
default = false;
|
||||||
description = "Whether to configure Nginx as a reverse proxy for Uptime Kuma";
|
description = "Whether to configure Nginx as a reverse proxy for Uptime Kuma";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
configurePangolin = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether to configure Pangolin as a reverse proxy for Uptime Kuma";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
@@ -65,6 +71,31 @@
|
|||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
newt.blueprint.proxy-resources = mkIf cfg.configurePangolin {
|
||||||
|
uptime-kuma = {
|
||||||
|
auth = {
|
||||||
|
sso-enabled = false;
|
||||||
|
};
|
||||||
|
full-domain = cfg.domain;
|
||||||
|
name = "uptime-kuma";
|
||||||
|
protocol = "http";
|
||||||
|
targets = [
|
||||||
|
{
|
||||||
|
hostname = "localhost";
|
||||||
|
method = "http";
|
||||||
|
port = cfg.port;
|
||||||
|
healthcheck = {
|
||||||
|
hostname = "localhost";
|
||||||
|
port = cfg.port;
|
||||||
|
scheme = "http";
|
||||||
|
method = "GET";
|
||||||
|
path = "/";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,6 +38,12 @@
|
|||||||
default = false;
|
default = false;
|
||||||
description = "Whether to configure Nginx as a reverse proxy for Vaultwarden";
|
description = "Whether to configure Nginx as a reverse proxy for Vaultwarden";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
configurePangolin = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether to configure Pangolin as a reverse proxy for Vaultwarden";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
@@ -73,6 +79,31 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
newt.blueprint.proxy-resources = mkIf cfg.configurePangolin {
|
||||||
|
vaultwarden = {
|
||||||
|
auth = {
|
||||||
|
sso-enabled = false;
|
||||||
|
};
|
||||||
|
full-domain = cfg.domain;
|
||||||
|
name = "vaultwarden";
|
||||||
|
protocol = "http";
|
||||||
|
targets = [
|
||||||
|
{
|
||||||
|
hostname = "localhost";
|
||||||
|
method = "http";
|
||||||
|
port = cfg.port;
|
||||||
|
healthcheck = {
|
||||||
|
hostname = "localhost";
|
||||||
|
port = cfg.port;
|
||||||
|
scheme = "http";
|
||||||
|
method = "GET";
|
||||||
|
path = "/";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
postgresql = {
|
postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
ensureDatabases = [ "vaultwarden" ];
|
ensureDatabases = [ "vaultwarden" ];
|
||||||
|
|||||||
Reference in New Issue
Block a user