feat: Homepage
This commit is contained in:
@@ -19,6 +19,36 @@ let
|
||||
for this virtual host.
|
||||
'';
|
||||
};
|
||||
homepage = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to expose this virtual host on homepage-dashboard.
|
||||
'';
|
||||
};
|
||||
group = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "Web";
|
||||
description = ''
|
||||
Homepage service group for this virtual host.
|
||||
'';
|
||||
};
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
Optional display name for homepage-dashboard. Defaults to the subdomain.
|
||||
'';
|
||||
};
|
||||
description = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
Optional homepage-dashboard description for this virtual host.
|
||||
'';
|
||||
};
|
||||
};
|
||||
port = lib.mkOption {
|
||||
type = with lib.types; nullOr port;
|
||||
default = null;
|
||||
@@ -67,14 +97,18 @@ in
|
||||
{
|
||||
subdomain = "gitea";
|
||||
port = 8080;
|
||||
homepage.description = "Git forge";
|
||||
}
|
||||
{
|
||||
subdomain = "dev";
|
||||
root = "/var/www/dev";
|
||||
homepage.description = "Static site";
|
||||
}
|
||||
{
|
||||
subdomain = "jellyfin";
|
||||
port = 8096;
|
||||
homepage.group = "Media";
|
||||
homepage.description = "Media server";
|
||||
extraConfig = {
|
||||
locations."/socket" = {
|
||||
proxyPass = "http://localhost:8096/";
|
||||
@@ -109,6 +143,24 @@ in
|
||||
}
|
||||
];
|
||||
|
||||
my.homepage.services = map (
|
||||
vhost:
|
||||
{
|
||||
group = vhost.homepage.group;
|
||||
name = if vhost.homepage.name != "" then vhost.homepage.name else vhost.subdomain;
|
||||
description =
|
||||
if vhost.homepage.description != "" then
|
||||
vhost.homepage.description
|
||||
else if vhost.root != null then
|
||||
"Static site"
|
||||
else if vhost.port != null then
|
||||
"Reverse proxied service"
|
||||
else
|
||||
"Web service";
|
||||
href = "https://${vhost.subdomain}.${domain}";
|
||||
}
|
||||
) (builtins.filter (vhost: vhost.homepage.enable) cfg.virtualHosts);
|
||||
|
||||
services = {
|
||||
nginx.enable = false;
|
||||
caddy = {
|
||||
|
||||
Reference in New Issue
Block a user