manual_inherit
This commit is contained in:
@@ -12,9 +12,9 @@ let
|
||||
hostedServiceSites =
|
||||
let
|
||||
servicesCfg = config.${namespace}.services;
|
||||
serviceNames = builtins.attrNames servicesCfg;
|
||||
serviceNames = attrNames servicesCfg;
|
||||
in
|
||||
builtins.concatMap (
|
||||
concatMap (
|
||||
serviceName:
|
||||
let
|
||||
serviceCfg = servicesCfg.${serviceName};
|
||||
@@ -24,9 +24,7 @@ let
|
||||
[
|
||||
(
|
||||
{
|
||||
title = hosted.title;
|
||||
url = hosted.url;
|
||||
icon = hosted.icon;
|
||||
inherit (hosted) title url icon;
|
||||
}
|
||||
// optionalAttrs hosted.basicAuth {
|
||||
basic-auth = {
|
||||
@@ -40,9 +38,9 @@ let
|
||||
[ ]
|
||||
) serviceNames;
|
||||
|
||||
hostedServicesByGroup = builtins.groupBy (svc: svc.hostedService.group) (
|
||||
builtins.filter (svc: svc.hostedService != null && svc.hostedService.enable) (
|
||||
builtins.map (
|
||||
hostedServicesByGroup = groupBy (svc: svc.hostedService.group) (
|
||||
filter (svc: svc.hostedService != null && svc.hostedService.enable) (
|
||||
map (
|
||||
serviceName:
|
||||
let
|
||||
serviceCfg = config.${namespace}.services.${serviceName};
|
||||
@@ -50,7 +48,7 @@ let
|
||||
{
|
||||
hostedService = serviceCfg.hostedService or null;
|
||||
}
|
||||
) (builtins.attrNames config.${namespace}.services)
|
||||
) (attrNames config.${namespace}.services)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -332,7 +330,7 @@ let
|
||||
settings = {
|
||||
server = {
|
||||
host = "0.0.0.0";
|
||||
port = cfg.port;
|
||||
inherit (cfg) port;
|
||||
};
|
||||
pages = [
|
||||
{
|
||||
@@ -371,31 +369,27 @@ let
|
||||
}
|
||||
]
|
||||
++ lib.optionals cfg.hostedServiceGroups (
|
||||
builtins.map (
|
||||
map (
|
||||
groupName:
|
||||
makeMonitorWidget groupName (
|
||||
builtins.map (svc: {
|
||||
title = svc.hostedService.title;
|
||||
url = svc.hostedService.url;
|
||||
icon = svc.hostedService.icon;
|
||||
map (svc: {
|
||||
inherit (svc.hostedService) title url icon;
|
||||
}) (hostedServicesByGroup.${groupName} or [ ])
|
||||
)
|
||||
) (builtins.attrNames hostedServicesByGroup)
|
||||
) (attrNames hostedServicesByGroup)
|
||||
)
|
||||
++ lib.optionals (!cfg.hostedServiceGroups && cfg.enableHostedServices) [
|
||||
(makeMonitorWidget "Services" hostedServiceSites)
|
||||
]
|
||||
++ lib.optionals (cfg.extraSites != [ ]) (
|
||||
builtins.map (site: {
|
||||
map (site: {
|
||||
type = "monitor";
|
||||
cache = "1m";
|
||||
title = site.title;
|
||||
inherit (site) title;
|
||||
sites = [
|
||||
(
|
||||
{
|
||||
title = site.title;
|
||||
url = site.url;
|
||||
icon = site.icon;
|
||||
inherit (site) title url icon;
|
||||
}
|
||||
// optionalAttrs site.allow-insecure { allow-insecure = true; }
|
||||
)
|
||||
@@ -407,7 +401,7 @@ let
|
||||
groups = cfg.bookmarks;
|
||||
}
|
||||
++ lib.optionals (cfg.reddit != [ ]) (
|
||||
builtins.map (subreddit: {
|
||||
map (subreddit: {
|
||||
type = "reddit";
|
||||
inherit subreddit;
|
||||
}) cfg.reddit
|
||||
|
||||
Reference in New Issue
Block a user