mirror of https://gitlab.crans.org/nounous/nixos
be better and fetch all
parent
326cfb1912
commit
2ac52affc3
|
|
@ -2,13 +2,39 @@
|
||||||
let
|
let
|
||||||
cfg = config.services.forgejo;
|
cfg = config.services.forgejo;
|
||||||
srv = cfg.settings.server;
|
srv = cfg.settings.server;
|
||||||
otherHosts = lib.filterAttrs
|
|
||||||
(name: _: name != "cransIso" && name != config.networking.hostName)
|
|
||||||
self.nixosConfigurations;
|
|
||||||
|
|
||||||
allGatusEndpoints =
|
# aidé
|
||||||
config.crans.gatus.endpoints
|
getHostsFromDir = dir:
|
||||||
++ lib.concatMap (machine: machine.config.crans.gatus.endpoints or [ ]) (lib.attrValues otherHosts);
|
let
|
||||||
|
entries = builtins.readDir dir;
|
||||||
|
hostDirs = lib.filterAttrs (_: type: type == "directory") entries;
|
||||||
|
in
|
||||||
|
lib.mapAttrsToList (name: _:
|
||||||
|
let
|
||||||
|
infoPath = dir + "/${name}/info.nix";
|
||||||
|
# On importe info.nix s'il existe
|
||||||
|
info = if builtins.pathExists infoPath then import infoPath else { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
inherit name info;
|
||||||
|
}
|
||||||
|
) hostDirs;
|
||||||
|
|
||||||
|
# On récupère les listes de toutes les VM et machines physiques (même sans default.nix !)
|
||||||
|
allVms = getHostsFromDir ../hosts/vm;
|
||||||
|
allPhysiques = getHostsFromDir ../hosts/physiques;
|
||||||
|
allHosts = allVms ++ allPhysiques;
|
||||||
|
# fin de l'aides
|
||||||
|
|
||||||
|
# On refait la liste des gatus endpoints
|
||||||
|
endpointsFromInfos = lib.concatMap (host:
|
||||||
|
let
|
||||||
|
customEndpoints = host.info.gatus.endpoints or [ ];
|
||||||
|
in
|
||||||
|
customEndpoints
|
||||||
|
) allHosts;
|
||||||
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services.openssh.settings.AcceptEnv = [ "GIT_PROTOCOL" ];
|
services.openssh.settings.AcceptEnv = [ "GIT_PROTOCOL" ];
|
||||||
|
|
@ -44,7 +70,7 @@ in
|
||||||
ui.link = "https://crans.org";
|
ui.link = "https://crans.org";
|
||||||
storage.type = "memory";
|
storage.type = "memory";
|
||||||
#storage.path = "gatus.db";
|
#storage.path = "gatus.db";
|
||||||
endpoints = allGatusEndpoints;
|
endpoints = endpointsFromInfos;
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue