mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 23:29:08 +01:00
glance: Init module
This commit is contained in:
parent
fe5113d476
commit
7fb596cdeb
1 changed files with 68 additions and 0 deletions
68
modules/nixos/web-services/glance.nix
Normal file
68
modules/nixos/web-services/glance.nix
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
allHosts,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
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 }:
|
||||||
|
{
|
||||||
|
type = "monitor";
|
||||||
|
cache = "1m";
|
||||||
|
title = "Services - ${hostName}";
|
||||||
|
sites = services;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.custom.web-services.glance = {
|
||||||
|
enable = lib.mkEnableOption "";
|
||||||
|
domain = lib.mkOption {
|
||||||
|
type = lib.types.nonEmptyStr;
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 63958;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
services.glance = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
server.port = cfg.port;
|
||||||
|
|
||||||
|
pages = lib.singleton {
|
||||||
|
name = "Home";
|
||||||
|
center-vertically = true;
|
||||||
|
|
||||||
|
columns = lib.singleton {
|
||||||
|
size = "full";
|
||||||
|
widgets =
|
||||||
|
lib.singleton {
|
||||||
|
type = "search";
|
||||||
|
search-engine = "google";
|
||||||
|
autofocus = true;
|
||||||
|
}
|
||||||
|
++ servicesWidgets;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
custom.services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue