feat(homepage-dashboard): add services option
This commit is contained in:
parent
ef434f6dcf
commit
cd2f42a344
@ -53,16 +53,10 @@ in {
|
||||
|
||||
networking.firewall.interfaces."${firewallInterface}".allowedTCPPorts = [cfg.port];
|
||||
|
||||
services.homepage-dashboard.services = [
|
||||
{
|
||||
Git = {
|
||||
Forgejo = {
|
||||
href = url;
|
||||
description = "Beyond coding. We forge.";
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
my.services.homepage-dashboard.services.Git.Forgejo = {
|
||||
href = forgejoUrl;
|
||||
description = "Beyond coding. We forge.";
|
||||
};
|
||||
})
|
||||
(mkIf cfg.proxy {
|
||||
services.caddy.virtualHosts."${forgejoDomain}".extraConfig = ''
|
||||
|
@ -23,6 +23,21 @@ in {
|
||||
default = 8082;
|
||||
description = "HTTP port for the homepage-dashboard service.";
|
||||
};
|
||||
services = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
description = "Attrset of services by group.";
|
||||
example = ''
|
||||
{
|
||||
Group = {
|
||||
App = {
|
||||
href = "https://example.com";
|
||||
description = "An amazing app!";
|
||||
};
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
@ -30,7 +45,22 @@ in {
|
||||
services.homepage-dashboard = {
|
||||
enable = true;
|
||||
listenPort = cfg.port;
|
||||
settings.logpath = "/var/log/homepage-dashboard";
|
||||
# Convert services to YAML format
|
||||
services =
|
||||
lib.mapAttrsToList (
|
||||
groupName: groupAttrs: {
|
||||
${groupName} = (
|
||||
lib.mapAttrsToList (
|
||||
serviceName: serviceAttrs: {${serviceName} = serviceAttrs;}
|
||||
)
|
||||
groupAttrs
|
||||
);
|
||||
}
|
||||
)
|
||||
cfg.services;
|
||||
};
|
||||
systemd.services.homepage-dashboard.environment.LOG_TARGETS = "stdout";
|
||||
|
||||
networking.firewall.interfaces."${firewallInterface}".allowedTCPPorts = [cfg.port];
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user