mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 17:49:07 +01:00
Compare commits
2 commits
fab7e3ed3d
...
19548f8486
| Author | SHA1 | Date | |
|---|---|---|---|
| 19548f8486 | |||
| 1c80dbef8b |
23 changed files with 77 additions and 39 deletions
|
|
@ -1,18 +1,22 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
options.custom.meta.services = lib.mkOption {
|
||||
options.custom.meta.sites = lib.mkOption {
|
||||
type = lib.types.attrsOf (
|
||||
lib.types.submodule (
|
||||
{ name, ... }:
|
||||
{ name, config, ... }:
|
||||
{
|
||||
options = {
|
||||
title = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
default = name;
|
||||
};
|
||||
domain = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
default = name;
|
||||
};
|
||||
url = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
default = "https://${name}";
|
||||
default = "https://${config.domain}";
|
||||
};
|
||||
icon = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
|
|
@ -101,7 +101,7 @@ in
|
|||
custom = {
|
||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "Alertmanager";
|
||||
icon = "sh:prometheus";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ in
|
|||
custom = {
|
||||
services.caddy.virtualHosts.${cfg.domain}.port = lib.mkIf (cfg.domain != null) cfg.port;
|
||||
|
||||
meta.services.${cfg.domain} = lib.mkIf (cfg.domain != null) {
|
||||
meta.sites.${cfg.domain} = lib.mkIf (cfg.domain != null) {
|
||||
title = "Alloy";
|
||||
icon = "sh:grafana-alloy";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ in
|
|||
|
||||
persistence.directories = [ "/var/lib/${config.services.prometheus.stateDir}" ];
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "Prometheus";
|
||||
icon = "sh:prometheus";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ in
|
|||
|
||||
persistence.directories = [ dataDir ];
|
||||
|
||||
meta.services.${cfg.gui.domain} = lib.mkIf (cfg.gui.domain != null) {
|
||||
meta.sites.${cfg.gui.domain} = lib.mkIf (cfg.gui.domain != null) {
|
||||
title = "Syncthing";
|
||||
icon = "sh:syncthing";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ in
|
|||
|
||||
persistence.directories = [ dataDir ];
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "Actual Budget";
|
||||
icon = "sh:actual-budget";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ in
|
|||
|
||||
persistence.directories = [ dataDir ];
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "Atuin";
|
||||
icon = "sh:atuin";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ in
|
|||
|
||||
persistence.directories = [ dataDir ];
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "File Browser";
|
||||
icon = "sh:file-browser";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ in
|
|||
|
||||
persistence.directories = [ config.services.forgejo.stateDir ];
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "Forgejo";
|
||||
icon = "sh:forgejo";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ in
|
|||
|
||||
persistence.directories = [ dataDir ];
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "FreshRSS";
|
||||
icon = "sh:freshrss";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ in
|
|||
|
||||
persistence.directories = [ dataDir ];
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "Gatus";
|
||||
icon = "sh:gatus";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
config,
|
||||
self,
|
||||
lib,
|
||||
allHosts,
|
||||
...
|
||||
|
|
@ -7,23 +8,55 @@
|
|||
let
|
||||
cfg = config.custom.web-services.glance;
|
||||
|
||||
servicesWidgets =
|
||||
allHosts
|
||||
|> lib.attrValues
|
||||
|> lib.map (host: {
|
||||
hostName = host.config.networking.hostName;
|
||||
services = host.config.custom.meta.services |> lib.attrValues;
|
||||
})
|
||||
|> lib.filter ({ services, ... }: services != [ ])
|
||||
|> lib.map (
|
||||
{ hostName, services }:
|
||||
{
|
||||
observabilityTitles = [
|
||||
"Alloy"
|
||||
"Prometheus"
|
||||
"Alertmanager"
|
||||
];
|
||||
|
||||
hosts = allHosts |> lib.attrValues;
|
||||
|
||||
applicationSites =
|
||||
hosts
|
||||
|> lib.concatMap (host: host.config.custom.meta.sites |> lib.attrValues)
|
||||
|> lib.filter (service: !lib.elem service.title observabilityTitles)
|
||||
|> lib.groupBy (
|
||||
service:
|
||||
service.domain |> self.lib.isPrivateDomain |> (isPrivate: if isPrivate then "Private" else "Public")
|
||||
)
|
||||
|> lib.mapAttrsToList (
|
||||
name: value: {
|
||||
type = "monitor";
|
||||
cache = "1m";
|
||||
title = "Services - ${hostName}";
|
||||
sites = services;
|
||||
title = "${name} Services";
|
||||
sites = value;
|
||||
}
|
||||
);
|
||||
)
|
||||
|> (widgets: {
|
||||
type = "split-column";
|
||||
max-columns = 2;
|
||||
inherit widgets;
|
||||
})
|
||||
|> lib.singleton;
|
||||
|
||||
observabilitySites =
|
||||
hosts
|
||||
|> lib.map (host: {
|
||||
type = "monitor";
|
||||
cache = "1m";
|
||||
title = host.config.networking.hostName;
|
||||
sites =
|
||||
host.config.custom.meta.sites
|
||||
|> lib.attrValues
|
||||
|> lib.filter (service: lib.elem service.title observabilityTitles);
|
||||
})
|
||||
|> lib.filter ({ sites, ... }: sites != [ ])
|
||||
|> (widgets: {
|
||||
type = "split-column";
|
||||
max-columns = widgets |> lib.length;
|
||||
inherit widgets;
|
||||
})
|
||||
|> lib.singleton;
|
||||
in
|
||||
{
|
||||
options.custom.web-services.glance = {
|
||||
|
|
@ -57,7 +90,8 @@ in
|
|||
search-engine = "google";
|
||||
autofocus = true;
|
||||
}
|
||||
++ servicesWidgets;
|
||||
++ applicationSites
|
||||
++ observabilitySites;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ in
|
|||
custom = {
|
||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "Grafana";
|
||||
icon = "sh:grafana";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ in
|
|||
custom = {
|
||||
services.caddy.virtualHosts.${cfg.domain}.files = "${pkgs.it-tools}/lib";
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "IT-Tools";
|
||||
icon = "sh:it-tools";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ in
|
|||
"/var/lib/meilisearch"
|
||||
];
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "Karakeep";
|
||||
icon = "sh:karakeep";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ in
|
|||
custom = {
|
||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "Networking Toolbox";
|
||||
icon = "sh:networking-toolbox";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ in
|
|||
custom = {
|
||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "ntfy";
|
||||
icon = "sh:ntfy";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ in
|
|||
config.services.postgresql.dataDir
|
||||
];
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "Outline";
|
||||
icon = "sh:outline";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ in
|
|||
custom = {
|
||||
services.caddy.virtualHosts.${cfg.domain}.files = dataDir;
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "Blog";
|
||||
icon = "sh:hugo";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ in
|
|||
custom = {
|
||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "PrivateBin";
|
||||
icon = "sh:privatebin";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ in
|
|||
|
||||
persistence.directories = [ dataDir ];
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "Radicale";
|
||||
icon = "sh:radicale";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ in
|
|||
custom = {
|
||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "Screego";
|
||||
icon = "mdi:projector-screen-outline";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ in
|
|||
custom = {
|
||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||
|
||||
meta.services.${cfg.domain} = {
|
||||
meta.sites.${cfg.domain} = {
|
||||
title = "Stirling PDF";
|
||||
icon = "sh:stirling-pdf";
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue