mirror of https://gitlab.crans.org/nounous/nixos
78 lines
1.9 KiB
Nix
78 lines
1.9 KiB
Nix
{ config ,lib, self, ... }:
|
|
let
|
|
cfg = config.services.forgejo;
|
|
srv = cfg.settings.server;
|
|
|
|
# aidé
|
|
getHostsFromDir = dir:
|
|
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
|
|
{
|
|
services.openssh.settings.AcceptEnv = [ "GIT_PROTOCOL" ];
|
|
|
|
services.forgejo = {
|
|
enable = true;
|
|
|
|
settings = {
|
|
server = {
|
|
DOMAIN = "git-test.crans.org";
|
|
ROOT_URL = "https://${srv.DOMAIN}";
|
|
HTTP_PORT = 3000;
|
|
};
|
|
service = {
|
|
DISABLE_REGISTRATION = true;
|
|
};
|
|
};
|
|
};
|
|
|
|
|
|
services.gatus = {
|
|
enable = true;
|
|
openFirewall = false;
|
|
settings = {
|
|
web.port = 8080;
|
|
ui.title = "Page Status Crans";
|
|
ui.description = "Show all Status for Crans infrasctructure";
|
|
ui.dashboard-heading = "Crans Status";
|
|
ui.dashboard-subheading = "Monitor the health of Crans endpoints in real-time";
|
|
ui.header = "Crans";
|
|
ui.logo = ../../../assets/logo_crans_dark.png ;
|
|
ui.favicon.default = ../../../assets/logo_crans_dark.png ;
|
|
ui.link = "https://crans.org";
|
|
storage.type = "memory";
|
|
#storage.path = "gatus.db";
|
|
endpoints = endpointsFromInfos;
|
|
|
|
};
|
|
};
|
|
}
|