mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
fix(exports): enable base services by default
This commit is contained in:
parent
77fd991ed1
commit
a1273971d9
14 changed files with 36 additions and 67 deletions
|
|
@ -3,8 +3,27 @@
|
|||
gensokyo-zone,
|
||||
...
|
||||
}: let
|
||||
inherit (gensokyo-zone.lib) mapAlmostOptionDefaults mkAlmostOptionDefault;
|
||||
inherit (gensokyo-zone.lib) mapListToAttrs mapAlmostOptionDefaults mkAlmostOptionDefault;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.attrsets) nameValuePair;
|
||||
mkExporter = { name, port }: nameValuePair "prometheus-exporters-${name}" ({config, ...}: {
|
||||
nixos = {
|
||||
serviceAttrPath = ["services" "prometheus" "exporters" name];
|
||||
assertions = mkIf config.enable [
|
||||
(nixosConfig: {
|
||||
assertion = config.ports.default.port == nixosConfig.services.prometheus.exporters.${name}.port;
|
||||
message = "port mismatch";
|
||||
})
|
||||
];
|
||||
};
|
||||
ports.default = mapAlmostOptionDefaults {
|
||||
inherit port;
|
||||
protocol = "http";
|
||||
};
|
||||
});
|
||||
exporters = mapListToAttrs mkExporter [
|
||||
{ name = "node"; port = 9091; }
|
||||
];
|
||||
in {
|
||||
config.exports.services = {
|
||||
prometheus = {config, ...}: {
|
||||
|
|
@ -23,22 +42,6 @@ in {
|
|||
protocol = "http";
|
||||
};
|
||||
};
|
||||
prometheus-exporters-node = {config, ...}: {
|
||||
id = mkAlmostOptionDefault "prometheus-exporters-node";
|
||||
nixos = {
|
||||
serviceAttrPath = ["services" "prometheus" "exporters" "node"];
|
||||
assertions = mkIf config.enable [
|
||||
(nixosConfig: {
|
||||
assertion = config.ports.default.port == nixosConfig.services.prometheus.exporters.node.port;
|
||||
message = "port mismatch";
|
||||
})
|
||||
];
|
||||
};
|
||||
ports.default = mapAlmostOptionDefaults {
|
||||
port = 9091;
|
||||
protocol = "http";
|
||||
};
|
||||
};
|
||||
grafana = {config, ...}: {
|
||||
id = mkAlmostOptionDefault "grafana";
|
||||
nixos = {
|
||||
|
|
@ -87,5 +90,5 @@ in {
|
|||
protocol = "http";
|
||||
};
|
||||
};
|
||||
};
|
||||
} // exporters;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue