mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 21:19: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, ... }:
|
{ lib, ... }:
|
||||||
{
|
{
|
||||||
options.custom.meta.services = lib.mkOption {
|
options.custom.meta.sites = lib.mkOption {
|
||||||
type = lib.types.attrsOf (
|
type = lib.types.attrsOf (
|
||||||
lib.types.submodule (
|
lib.types.submodule (
|
||||||
{ name, ... }:
|
{ name, config, ... }:
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
title = lib.mkOption {
|
title = lib.mkOption {
|
||||||
type = lib.types.nonEmptyStr;
|
type = lib.types.nonEmptyStr;
|
||||||
default = name;
|
default = name;
|
||||||
};
|
};
|
||||||
|
domain = lib.mkOption {
|
||||||
|
type = lib.types.nonEmptyStr;
|
||||||
|
default = name;
|
||||||
|
};
|
||||||
url = lib.mkOption {
|
url = lib.mkOption {
|
||||||
type = lib.types.nonEmptyStr;
|
type = lib.types.nonEmptyStr;
|
||||||
default = "https://${name}";
|
default = "https://${config.domain}";
|
||||||
};
|
};
|
||||||
icon = lib.mkOption {
|
icon = lib.mkOption {
|
||||||
type = lib.types.nonEmptyStr;
|
type = lib.types.nonEmptyStr;
|
||||||
|
|
@ -101,7 +101,7 @@ in
|
||||||
custom = {
|
custom = {
|
||||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "Alertmanager";
|
title = "Alertmanager";
|
||||||
icon = "sh:prometheus";
|
icon = "sh:prometheus";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ in
|
||||||
custom = {
|
custom = {
|
||||||
services.caddy.virtualHosts.${cfg.domain}.port = lib.mkIf (cfg.domain != null) cfg.port;
|
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";
|
title = "Alloy";
|
||||||
icon = "sh:grafana-alloy";
|
icon = "sh:grafana-alloy";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ in
|
||||||
|
|
||||||
persistence.directories = [ "/var/lib/${config.services.prometheus.stateDir}" ];
|
persistence.directories = [ "/var/lib/${config.services.prometheus.stateDir}" ];
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "Prometheus";
|
title = "Prometheus";
|
||||||
icon = "sh:prometheus";
|
icon = "sh:prometheus";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ in
|
||||||
|
|
||||||
persistence.directories = [ dataDir ];
|
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";
|
title = "Syncthing";
|
||||||
icon = "sh:syncthing";
|
icon = "sh:syncthing";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ in
|
||||||
|
|
||||||
persistence.directories = [ dataDir ];
|
persistence.directories = [ dataDir ];
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "Actual Budget";
|
title = "Actual Budget";
|
||||||
icon = "sh:actual-budget";
|
icon = "sh:actual-budget";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ in
|
||||||
|
|
||||||
persistence.directories = [ dataDir ];
|
persistence.directories = [ dataDir ];
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "Atuin";
|
title = "Atuin";
|
||||||
icon = "sh:atuin";
|
icon = "sh:atuin";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ in
|
||||||
|
|
||||||
persistence.directories = [ dataDir ];
|
persistence.directories = [ dataDir ];
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "File Browser";
|
title = "File Browser";
|
||||||
icon = "sh:file-browser";
|
icon = "sh:file-browser";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ in
|
||||||
|
|
||||||
persistence.directories = [ config.services.forgejo.stateDir ];
|
persistence.directories = [ config.services.forgejo.stateDir ];
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "Forgejo";
|
title = "Forgejo";
|
||||||
icon = "sh:forgejo";
|
icon = "sh:forgejo";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ in
|
||||||
|
|
||||||
persistence.directories = [ dataDir ];
|
persistence.directories = [ dataDir ];
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "FreshRSS";
|
title = "FreshRSS";
|
||||||
icon = "sh:freshrss";
|
icon = "sh:freshrss";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ in
|
||||||
|
|
||||||
persistence.directories = [ dataDir ];
|
persistence.directories = [ dataDir ];
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "Gatus";
|
title = "Gatus";
|
||||||
icon = "sh:gatus";
|
icon = "sh:gatus";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
self,
|
||||||
lib,
|
lib,
|
||||||
allHosts,
|
allHosts,
|
||||||
...
|
...
|
||||||
|
|
@ -7,23 +8,55 @@
|
||||||
let
|
let
|
||||||
cfg = config.custom.web-services.glance;
|
cfg = config.custom.web-services.glance;
|
||||||
|
|
||||||
servicesWidgets =
|
observabilityTitles = [
|
||||||
allHosts
|
"Alloy"
|
||||||
|> lib.attrValues
|
"Prometheus"
|
||||||
|> lib.map (host: {
|
"Alertmanager"
|
||||||
hostName = host.config.networking.hostName;
|
];
|
||||||
services = host.config.custom.meta.services |> lib.attrValues;
|
|
||||||
})
|
hosts = allHosts |> lib.attrValues;
|
||||||
|> lib.filter ({ services, ... }: services != [ ])
|
|
||||||
|> lib.map (
|
applicationSites =
|
||||||
{ hostName, services }:
|
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";
|
type = "monitor";
|
||||||
cache = "1m";
|
cache = "1m";
|
||||||
title = "Services - ${hostName}";
|
title = "${name} Services";
|
||||||
sites = 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
|
in
|
||||||
{
|
{
|
||||||
options.custom.web-services.glance = {
|
options.custom.web-services.glance = {
|
||||||
|
|
@ -57,7 +90,8 @@ in
|
||||||
search-engine = "google";
|
search-engine = "google";
|
||||||
autofocus = true;
|
autofocus = true;
|
||||||
}
|
}
|
||||||
++ servicesWidgets;
|
++ applicationSites
|
||||||
|
++ observabilitySites;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ in
|
||||||
custom = {
|
custom = {
|
||||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "Grafana";
|
title = "Grafana";
|
||||||
icon = "sh:grafana";
|
icon = "sh:grafana";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ in
|
||||||
custom = {
|
custom = {
|
||||||
services.caddy.virtualHosts.${cfg.domain}.files = "${pkgs.it-tools}/lib";
|
services.caddy.virtualHosts.${cfg.domain}.files = "${pkgs.it-tools}/lib";
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "IT-Tools";
|
title = "IT-Tools";
|
||||||
icon = "sh:it-tools";
|
icon = "sh:it-tools";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ in
|
||||||
"/var/lib/meilisearch"
|
"/var/lib/meilisearch"
|
||||||
];
|
];
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "Karakeep";
|
title = "Karakeep";
|
||||||
icon = "sh:karakeep";
|
icon = "sh:karakeep";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ in
|
||||||
custom = {
|
custom = {
|
||||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "Networking Toolbox";
|
title = "Networking Toolbox";
|
||||||
icon = "sh:networking-toolbox";
|
icon = "sh:networking-toolbox";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ in
|
||||||
custom = {
|
custom = {
|
||||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "ntfy";
|
title = "ntfy";
|
||||||
icon = "sh:ntfy";
|
icon = "sh:ntfy";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ in
|
||||||
config.services.postgresql.dataDir
|
config.services.postgresql.dataDir
|
||||||
];
|
];
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "Outline";
|
title = "Outline";
|
||||||
icon = "sh:outline";
|
icon = "sh:outline";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ in
|
||||||
custom = {
|
custom = {
|
||||||
services.caddy.virtualHosts.${cfg.domain}.files = dataDir;
|
services.caddy.virtualHosts.${cfg.domain}.files = dataDir;
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "Blog";
|
title = "Blog";
|
||||||
icon = "sh:hugo";
|
icon = "sh:hugo";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ in
|
||||||
custom = {
|
custom = {
|
||||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "PrivateBin";
|
title = "PrivateBin";
|
||||||
icon = "sh:privatebin";
|
icon = "sh:privatebin";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ in
|
||||||
|
|
||||||
persistence.directories = [ dataDir ];
|
persistence.directories = [ dataDir ];
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "Radicale";
|
title = "Radicale";
|
||||||
icon = "sh:radicale";
|
icon = "sh:radicale";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ in
|
||||||
custom = {
|
custom = {
|
||||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "Screego";
|
title = "Screego";
|
||||||
icon = "mdi:projector-screen-outline";
|
icon = "mdi:projector-screen-outline";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ in
|
||||||
custom = {
|
custom = {
|
||||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||||
|
|
||||||
meta.services.${cfg.domain} = {
|
meta.sites.${cfg.domain} = {
|
||||||
title = "Stirling PDF";
|
title = "Stirling PDF";
|
||||||
icon = "sh:stirling-pdf";
|
icon = "sh:stirling-pdf";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue