Module pour les infos.nix

merge-requests/104/head
Pyjacpp 2026-11-11 17:54:37 +01:00
parent c8dac2d45d
commit 1c4c776a1f
No known key found for this signature in database
GPG Key ID: ED479A5A26930939
36 changed files with 612 additions and 299 deletions

View File

@ -0,0 +1,5 @@
{
# XXX: Transformer en module NixOs
vlans = import ./vlans.nix;
switchs = import ./switchs.nix;
}

View File

@ -0,0 +1,6 @@
[
"arceus"
"carapuce"
"salameche"
"horst"
]

124
config/vlans.nix 100644
View File

@ -0,0 +1,124 @@
{
srv = {
id = 2;
description = "Réseau public";
interface = "ens19";
ipv4 = {
address = "185.230.79.0";
prefixLength = 26;
routes = [
{
address = "0.0.0.0";
via = "185.230.79.62";
prefixLength = 0;
}
];
};
ipv6 = {
address = "2a0c:700:10::";
routes = [
{
address = "::";
via = "2a0c:700:2::ff:fe00:9902";
prefixLength = 0;
}
];
};
};
srv-nat = {
id = 3;
description = "Réseau derrière un NAT";
interface = "ens19";
ipv4.routes = [
{
address = "0.0.0.0";
via = "172.16.3.99";
prefixLength = 0;
}
];
ipv6 = {
address = "2a0c:700:3::";
routes = [
{
address = "::";
via = "2a0c:700:3::ff:fe00:9903";
prefixLength = 0;
}
];
};
};
san = {
id = 4;
description = "Accès aux baies de stockages";
interface = "ens19";
};
ceph = {
id = 6;
description = "Réseau interne à ceph";
interface = "ens20";
};
adm = {
id = 10;
description = "Réseau interne";
interface = "ens18";
};
adh = {
id = 12;
description = "Réseau adhérent";
ipv4 = {
address = "185.230.78.0";
routes = [
{
address = "0.0.0.0";
via = "185.230.78.12";
prefixLength = 0;
}
];
};
ipv6 = {
address = "2a0c:700:12::";
prefixLength = 48;
routes = [
{
address = "::";
via = "2a0c:700:12::ff:fe00:9912";
prefixLength = 0;
}
];
};
};
adh-adm = {
id = 13;
description = "Réseau d’administration du réseau adhérent";
};
ens = {
id = 2751;
description = "Interconnexion avec l’ENS.";
ipv4 = {
address = "138.231.136.0";
prefixLength = 29;
};
ipv6 = null;
};
ens-clubs = {
id = 2754;
description = "Réseau clubs interconnecté avec l’ENS";
ipv6 = null;
};
ens-lp = {
id = 2756;
description = "Réseau imprimante interconnecté avec l’ENS";
ipv6 = null;
};
}

View File

@ -5,6 +5,7 @@
./hardware-configuration.nix
./networking.nix
./nginx.nix
./restic.nix
];
networking.hostId = "bbdd1133";

View File

@ -5,13 +5,13 @@
enable = true;
networking.adm.enable = false;
resticClient.enable = false;
services = {
resticServer = {
enable = true;
port = 4242;
};
networking = {
adm.enable = false;
};
monitoring = {
nginx.enable = true;
};
resticClient.enable = false;
}

View File

@ -0,0 +1,8 @@
{
config.crans.services = {
resticServer = {
enable = true;
port = 4242;
};
};
}

View File

@ -9,5 +9,9 @@
srv-nat.enable = true;
};
monitoring = {
nginx.enable = true;
};
resticClient.enable = false;
}

View File

@ -9,10 +9,14 @@
adm.enable = true;
srv = {
enable = true;
ipv4 = "185.230.79.19";
ipv4.address = "185.230.79.19";
};
};
monitoring = {
nginx.enable = true;
};
resticClient.when = "06:07";
services = {

View File

@ -24,7 +24,7 @@ in
rtc = {
use_external_ip = false;
node_ip = config.crans.networking.srv.ipv4;
node_ip = config.crans.info.networking.srv.ipv4.address;
tcp_port = 8101;
port_range_start = 50000;
port_range_end = 52000;

View File

@ -9,17 +9,17 @@
adm.enable = true;
srv = {
enable = true;
ipv4 = "185.230.79.15";
ipv4.address = "185.230.79.15";
};
};
monitoring = {
nginx.enable = true;
};
resticClient.when = "02:34";
services = {
acme.enable = true;
};
public-ssh = "";
}

View File

@ -9,5 +9,9 @@
srv-nat.enable = true;
};
monitoring = {
nginx.enable = true;
};
resticClient.when = "03:45";
}

View File

@ -9,5 +9,9 @@
srv-nat.enable = true;
};
monitoring = {
nginx.enable = true;
};
resticClient.when = "06:47";
}

View File

@ -8,10 +8,14 @@
networking = {
srv = {
enable = true;
ipv4 = "185.230.79.5";
ipv4.address = "185.230.79.5";
};
};
monitoring = {
nginx.enable = true;
};
resticClient.when = "04:56";
services = {

View File

@ -18,5 +18,9 @@
homeAdh.enable = true;
monitoring = {
nginx.enable = true;
};
resticClient.enable = false;
}

View File

@ -9,5 +9,9 @@
srv-nat.enable = true;
};
monitoring = {
nginx.enable = true;
};
resticClient.when = "02:56";
}

View File

@ -10,10 +10,15 @@
srv = {
enable = true;
interface = "ens20";
ipv4 = "185.230.79.42";
ipv4.address = "185.230.79.42";
};
};
resticClient.when = "03:42";
services.acme.enable = true;
monitoring = {
nginx.enable = true;
};
resticClient.when = "03:42";
}

View File

@ -230,10 +230,6 @@ in
"zero".proxyPass = "172.16.10.130";
};
};
services = {
acme.enable = true;
};
};
# Règle particulières

View File

@ -9,5 +9,9 @@
srv-nat.enable = true;
};
monitoring = {
nginx.enable = true;
};
resticClient.when = "04:44";
}

View File

@ -3,11 +3,6 @@
let
inherit (lib)
attrNames
attrsToList
isInt
isString
join
length
listToAttrs
filter
filterAttrs
@ -16,31 +11,9 @@ let
nixosSystem
readDir
warn
warnIf
warnIfNot
;
infoRequired = {
name = isString;
description = isString;
id = isInt;
};
verifyAttrs =
info:
let
missing = filter (n: !(info ? ${n})) (attrNames infoRequired);
wrongType = filter (n: info ? ${n.name} && !(n.value info.${n.name})) (attrsToList infoRequired);
in
(warnIf (
length missing > 0
) "${info.name}/info.nix : les attributs « ${join ", " missing} » sont manquants")
(warnIf (length wrongType > 0)
"${info.name}/info.nix : les attributs « ${join ", " (map (i: i.name) wrongType)} » sont mal typés"
)
(warnIfNot (
(info.isDebian or false) || info ? enable
) "${info.name}/info.nix : cette machine nix ne définit pas l’attribut enable")
info;
cransConfig = import ../config;
get_hosts_names = path: attrNames (filterAttrs (name: type: type == "directory") (readDir path));
get_info =
path:
@ -51,7 +24,15 @@ let
filePath = path + "/${name}/info.nix";
in
if builtins.pathExists filePath then
verifyAttrs (import filePath)
(lib.evalModules {
modules = [
../modules/info
filePath
];
specialArgs = {
crans = cransConfig;
};
}).config
else
warn "${toString filePath} not found" null
) (get_hosts_names path)
@ -67,10 +48,11 @@ rec {
nixosSystem {
specialArgs = inputs // {
hosts = all_hosts;
crans = cransConfig;
};
modules = [
(path + "/${name}")
({ ... }: { config.crans = info; })
({ ... }: { config.crans.info = info; })
]
++ baseModules;
}

View File

@ -1,10 +1,14 @@
{ lib, config, ... }:
{
lib,
config,
crans,
...
}:
let
cfg = config.crans;
cfg = config.crans.info;
inherit (lib)
mkEnableOption
mkOption
mkIf
types
@ -21,72 +25,24 @@ in
./ntp.nix
./restic_client.nix
./monitoring.nix
./motd.nix
./nullmailer.nix
./packages.nix
./ssh.nix
./store.nix
./users.nix
./vlans.nix
./virtualisation.nix
];
options.crans = {
enable = mkEnableOption "Configuration commune à toutes les machines du Crans";
name = mkOption {
type = types.str;
example = "vm-test";
description = "Nom de la machine";
};
isVm = mkOption {
type = types.bool;
description = "Est-ce une machine virtuelle ?";
};
isDebian = mkOption {
type = types.bool;
default = false;
example = "true";
description = "Est-ce une machine Debian ?";
};
description = mkOption {
type = types.str;
example = "VM de test";
description = "Description de la machine";
};
id = mkOption {
type = types.int;
example = 135;
description = ''
ID de la machine :
- < 100 machine physique
- >= 100 VM ( id de la VM dans proxmox )
'';
};
public-ssh = mkOption {
type = types.str;
description = "Clé ssh public de la machine";
options.crans.info = mkOption {
type = types.submoduleWith {
modules = [ ../info ];
specialArgs = { inherit crans; };
};
description = "Informations de la machines (info.nix)";
};
config = mkIf cfg.enable {
crans = {
homeNounou.enable = lib.mkDefault true;
monitoring.enable = true;
networking = {
enable = lib.mkDefault true;
adm.enable = lib.mkDefault true;
};
resticClient.enable = lib.mkDefault true;
users = {
ldap.enable = true;
};
};
warnings = (
optional (
cfg.isVm != (cfg.id >= 100)

View File

@ -1,21 +1,13 @@
{ lib, config, ... }:
let
cfg = config.crans;
cfg = config.crans.info;
inherit (lib) mkEnableOption mkIf;
inherit (lib) mkIf;
in
{
options.crans = {
homeNounou = {
enable = mkEnableOption "Monter /home_nounou.";
};
homeAdh = {
enable = mkEnableOption "Monter /home-adh";
};
};
# Options ../info/home.nix
config = {
fileSystems = {
home_nounou = mkIf cfg.homeNounou.enable {

View File

@ -1,32 +1,27 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
let
cfg = config.crans.monitoring;
cfg = config.crans.info.monitoring;
inherit (lib)
mkEnableOption
mkIf
mkOption
types
;
nginxEnable = config.services.nginx.enable;
inherit (lib) mkIf optional;
boolToStr = b: if b then "true" else "false";
in
{
options.crans.monitoring = {
enable = mkEnableOption "Monitoring prometheus de la machine.";
# Options ../info/monitoring.nix
nginx = {
enable = mkOption {
type = types.bool;
default = config.services.nginx.enable;
example = true;
description = "Monitoring de Nginx par prometheus.";
};
};
};
config = {
warnings = optional (cfg.enable && (nginxEnable != cfg.nginx.enable)) ''
${config.crans.info.name} : config.services.nginx.enable (${boolToStr nginxEnable}) n’est pas cohérent avec le monitoring déclaré dans l’info.nix (${boolToStr cfg.nginx.enable})
'';
config = mkIf cfg.enable {
services.prometheus.exporters = {
services.prometheus.exporters = mkIf cfg.enable {
node = {
enable = true;
port = 9100;

View File

@ -0,0 +1,19 @@
{ self, lib, ... }:
let
inherit (lib) removeSuffix;
in
{
users.motd =
let
shortRev = self.shortRev or self.dirtyShortRev or "inconnue";
rev = self.rev or (removeSuffix "-dirty" (self.dirtyRev or "inconnue"));
isDirty = !(self ? rev);
in
''
${
if isDirty then "!! DIRTY !! " else ""
}Version déployée ${shortRev}, modifiée le ${self.lastModifiedDate or "??"}.
https://gitlab.crans.org/nounous/nixos/-/commit/${rev}
'';
}

View File

@ -1,88 +1,24 @@
{
lib,
config,
hosts,
crans,
...
}:
let
cfg = config.crans;
cfg = config.crans.info;
cfg-net = cfg.networking;
inherit (lib)
mkEnableOption
mkIf
mkOption
mkDefault
types
mod
mapAttrs
mapAttrs'
filterAttrs
mergeAttrsList
optional
fixedWidthString
nameValuePair
;
in
{
options.crans.networking = {
enable = mkEnableOption "Configuration réseaux commune à toutes les machines du Crans.";
}
// mapAttrs (
vlan: conf:
let
vlanId = mod conf.id 100;
in
mergeAttrsList (
[
{
enable = mkEnableOption "Activation du réseau ${vlan}";
interface = mkOption {
type = types.str;
description = "Interface pour le réseau ${vlan}";
default = conf.interface;
};
defaultRoutes = mkOption {
type = types.bool;
default = true;
description = "Configuration par défaut des routes de ${vlan}";
};
}
]
++ optional ((conf.ipv4 or true) != null) {
ipv4 = mkOption {
type = types.str;
description = "Adresse IPv4 de la machine sur le réseau ${vlan}";
default = "172.16.${toString vlanId}.${toString cfg.id}";
};
}
++ optional ((conf.ipv6 or true) != null) (
let
# XXX: Utilisation du masque pour le déterminer à la place ?
prefix =
if lib.hasPrefix "2a0c:700" conf.ipv6.address then
"2a0c:700"
else if lib.hasPrefix "fd00:0:0" conf.ipv6.address then
"fd00:0:0"
else
(builtins.warn "Le prefixe de ${conf.ipv6.address} n’est pas reconnu");
in
{
ipv6 = mkOption {
type = types.str;
description = "Adresse IPv6 de la machine sur le réseau ${vlan}";
default = "${prefix}:${toString vlanId}::ff:fe0${toString (cfg.id / 100)}:${toString (mod cfg.id 100)}${
fixedWidthString 2 "0" (toString vlanId)
}";
};
}
)
)
) cfg.vlans;
# Options ../info/networking.nix
config = mkIf cfg-net.enable {
networking = {
hostName = cfg.name;
@ -95,24 +31,24 @@ in
];
interfaces = mapAttrs' (
vlan: vconf:
vname: _:
let
conf = cfg-net.${vlan};
conf = cfg-net.${vname};
in
nameValuePair conf.interface (
# On itère ipv4 / ipv6
builtins.mapAttrs
(
ipvx: _:
mkIf (vconf.${ipvx} != null) {
mkIf (conf.${ipvx} != null) {
addresses = [
{
address = conf.${ipvx};
prefixLength = vconf.${ipvx}.prefixLength;
address = conf.${ipvx}.address;
prefixLength = conf.${ipvx}.prefixLength;
}
];
routes = mkIf conf.defaultRoutes vconf.${ipvx}.routes;
routes = conf.${ipvx}.routes;
}
)
{
@ -120,7 +56,7 @@ in
"ipv6" = null;
}
)
) (filterAttrs (n: _: cfg-net.${n}.enable) cfg.vlans); # On filtre les interfaces désactivées.
) (filterAttrs (n: _: cfg-net.${n}.enable) crans.vlans); # On filtre les interfaces désactivées.
};
};
}

View File

@ -1,40 +1,13 @@
{ config, lib, ... }:
let
cfg = config.crans.resticClient;
cfg = config.crans.info.resticClient;
inherit (lib)
mkEnableOption
mkIf
mkOption
types
;
inherit (lib) mkIf;
in
{
options.crans.resticClient = {
enable = mkEnableOption "Configuration générale pour le client restic.";
additionalPaths = mkOption {
type = types.listOf types.path;
default = [ ];
example = [ "/backup" ];
description = "Chemins à backuper en plus de ceux par défaut.";
};
additionalExcludes = mkOption {
type = types.listOf types.path;
default = [ ];
example = [ "/var/lib/<service>/cache" ];
description = "Chemins à exclure des backups en plus de ceux par défaut.";
};
when = mkOption {
type = types.str;
example = "05:42";
description = "À quelle heure faire les backups.";
};
};
# Options ../info/resticClient.nix
config = mkIf cfg.enable {
age.secrets = {
@ -52,11 +25,13 @@ in
paths = [
"/etc"
"/var"
] ++ cfg.additionalPaths;
]
++ cfg.additionalPaths;
exclude = [
"/var/cache"
"/var/lib/lxcfs"
] ++ cfg.additionalExcludes;
]
++ cfg.additionalExcludes;
timerConfig = {
OnCalendar = cfg.when;
RandomizedDelaySec = "6h";

View File

@ -1,35 +1,9 @@
{
config,
lib,
self,
...
}:
{ config, ... }:
let
cfg = config.crans.users;
inherit (lib)
mkEnableOption
mkOption
types
;
cfg = config.crans.info.users;
in
{
options.crans.users = {
ldap = {
enable = mkEnableOption "Authentification par le LDAP adm.";
};
root = {
passwordFile = mkOption {
type = types.path;
default = ../../secrets/common/root.age;
example = ../../secrets/apprentix/root.age;
description = "Fichier chiffré par age contenant le mot de passe root.";
};
};
};
# Options : ../info/users.nix
config = {
age.secrets.root-passwd-hash = {
@ -39,20 +13,6 @@ in
users = {
mutableUsers = false;
motd =
let
shortRev = self.shortRev or self.dirtyShortRev or "inconnue";
rev = self.rev or (lib.strings.removeSuffix "-dirty" (self.dirtyRev or "inconnue"));
isDirty = !(self ? rev);
in
''
${
if isDirty then "!! DIRTY !! " else ""
}Version déployée ${shortRev}, modifiée le ${self.lastModifiedDate or "??"}.
https://gitlab.crans.org/nounous/nixos/-/commit/${rev}
'';
users.root = {
hashedPasswordFile = config.age.secrets.root-passwd-hash.path;
};

View File

@ -0,0 +1,7 @@
{ lib, ... }:
let
inherit (lib) mkEnableOption;
in
{
options.services.acme.enable = mkEnableOption "Activer les certificats ACME via let's encrypt.";
}

View File

@ -0,0 +1,46 @@
{ lib, config, ... }:
let
inherit (lib)
mkDefault
mkOption
mkIf
types
;
in
# Point Important
# L’évaluation se fait en deux passe.
# 1. La flake.nix avec la lib/info.nix évalue les info.nix
# 2. Les VMs évaluent la conf en partant de cette évaluation
# Il n’est donc pas possible de redéfinir les options des infos dans les conf
# des VMs (même avec des mkForce and co) puisque la conf est déjà merge lors de la
# première évaluation (les mkXX sont donc applatit à ce moment là)
{
imports = [
./acme.nix
./home.nix
./meta.nix
./monitoring.nix
./networking.nix
./resticClient.nix
./users.nix
];
options.enable = mkOption {
type = types.bool;
example = true;
description = "Activer la configuration Crans par défaut";
# On n’utilise pas mkEnableOption pour forcer la définition de enable à true
# ou false (et limiter les oublis)
};
config = mkIf config.enable {
homeNounou.enable = mkDefault true;
monitoring.enable = mkDefault true;
networking = {
enable = mkDefault true;
adm.enable = mkDefault true;
};
resticClient.enable = mkDefault true;
users = {
ldap.enable = mkDefault true;
};
};
}

View File

@ -0,0 +1,10 @@
{ lib, ... }:
let
inherit (lib) mkEnableOption;
in
{
options = {
homeNounou.enable = mkEnableOption "Monter /home_nounou.";
homeAdh.enable = mkEnableOption "Monter /home-adh";
};
}

View File

@ -0,0 +1,43 @@
{ lib, ... }:
let
inherit (lib) mkOption types;
in
{
options = {
name = mkOption {
type = types.str;
description = "Nom de la machine";
};
description = mkOption {
type = types.str;
description = "Description de la machine";
};
id = mkOption {
type = types.int;
example = 135;
description = "
ID de la machine :
- < 100 machine physique
- >= 100 VM ( id de la VM dans proxmox )
";
};
isVm = mkOption {
type = types.bool;
description = "Est-ce une machine virtuelle ?";
};
isDebian = mkOption {
type = types.bool;
description = "Est-ce que c’est une machine sous Débian ?";
default = false;
};
public-ssh = mkOption {
type = types.str;
description = "Clé ssh public de la machine";
};
};
}

View File

@ -0,0 +1,18 @@
{ lib, ... }:
let
inherit (lib) mkEnableOption mkOption types;
in
{
options.monitoring = {
enable = mkEnableOption "Monitoring prometheus de la machine.";
nginx = {
enable = mkOption {
type = types.bool;
example = true;
description = "Monitoring de Nginx par prometheus.";
default = false;
};
};
};
}

View File

@ -0,0 +1,148 @@
{
config,
crans,
lib,
...
}:
let
inherit (lib)
fixedWidthString
hasPrefix
listToAttrs
mapAttrs
mergeAttrsList
mod
mkEnableOption
mkOption
optional
optionalAttrs
nameValuePair
types
;
switchOptions = listToAttrs (
map (
n:
nameValuePair n (mkOption {
type = types.nullOr types.int;
description = "Port sur le switch ${n}";
default = null;
})
) crans.switchs
);
routesType = types.listOf (
types.submodule {
options = {
address = mkOption {
type = types.str;
description = "Réseau de destination";
};
prefixLength = mkOption {
type = types.int;
description = "Masque du réseau de destination";
};
via = mkOption {
type = types.str;
description = "Ip de la gateway";
};
};
}
);
in
{
options = {
ilo.id = mkOption {
type = types.nullOr types.int;
description = "Identifiant de l’ilo";
default = null;
};
ilo.switch = switchOptions;
# TODO: vérifier que les IPs déclarées sont bien dans le réseau vlan (masque)
networking = {
enable = mkEnableOption "Activation du réseau Crans";
switch = switchOptions;
}
// mapAttrs (
vname: vconf:
mergeAttrsList (
[
{
enable = mkEnableOption "Activation du réseau ${vname}";
interface = mkOption {
type = types.str;
description = "Interface pour le réseau ${vname}";
default = vconf.interface;
};
tag = mkOption {
type = types.int;
description = "Tag du vlan";
readOnly = true;
default = vconf.id;
};
}
]
++ optional ((vconf.ipv4 or { }) != null) {
ipv4.address =
mkOption {
type = types.str;
description = "Adresse IPv4 de la machine sur le réseau ${vname}";
}
// (optionalAttrs (hasPrefix "172.16" (vconf.ipv4.address or "172.16.0.0")) {
default = "172.16.${toString vconf.id}.${toString config.id}";
});
ipv4.prefixLength = mkOption {
type = types.int;
description = "Masque IPv4 de la machine sur le réseau ${vname}";
default = vconf.ipv4.prefixLength or 24;
};
ipv4.routes = mkOption {
type = routesType;
description = "Routes de l’interface";
default = vconf.ipv4.routes or [ ];
};
}
++ optional ((vconf.ipv6 or { }) != null) (
let
# XXX: Utilisation du masque pour le déterminer à la place ?
prefix =
if !(vconf ? ipv6) || lib.hasPrefix "fd00:0:0" vconf.ipv6.address then
"fd00:0:0"
else if lib.hasPrefix "2a0c:700" vconf.ipv6.address then
"2a0c:700"
else
(builtins.warn "Le prefixe de ${vconf.ipv6.address} n’est pas reconnu");
in
{
ipv6.address = mkOption {
type = types.str;
description = "Adresse IPv6 de la machine sur le réseau ${vname}";
default = "${prefix}:${toString vconf.id}::ff:fe0${toString (config.id / 100)}:${toString (mod config.id 100)}${
fixedWidthString 2 "0" (toString vconf.id)
}";
};
ipv6.prefixLength = mkOption {
type = types.int;
description = "Masque IPv6 de la machine sur le réseau ${vname}";
default = vconf.ipv6.prefixLength or 64;
};
ipv6.routes = mkOption {
type = routesType;
description = "Routes de l’interface";
default = vconf.ipv6.routes or [ ];
};
}
)
)
) crans.vlans
;
};
}

View File

@ -0,0 +1,29 @@
{ lib, ... }:
let
inherit (lib) mkEnableOption mkOption types;
in
{
options.resticClient = {
enable = mkEnableOption "Configuration générale pour le client restic.";
additionalPaths = mkOption {
type = types.listOf types.path;
default = [ ];
example = [ "/backup" ];
description = "Chemins à backuper en plus de ceux par défaut.";
};
additionalExcludes = mkOption {
type = types.listOf types.path;
default = [ ];
example = [ "/var/lib/<service>/cache" ];
description = "Chemins à exclure des backups en plus de ceux par défaut.";
};
when = mkOption {
type = types.str;
example = "05:42";
description = "À quelle heure faire les backups.";
};
};
}

View File

@ -0,0 +1,20 @@
{ lib, ... }:
let
inherit (lib) mkEnableOption mkOption types;
in
{
options.users = {
ldap = {
enable = mkEnableOption "Authentification par le LDAP adm.";
};
root = {
passwordFile = mkOption {
type = types.path;
default = ../../secrets/common/root.age;
example = ../../secrets/apprentix/root.age;
description = "Fichier chiffré par age contenant le mot de passe root.";
};
};
};
}

View File

@ -1,16 +1,13 @@
{ config, lib, ... }:
let
cfg = config.crans.services.acme;
cfg = config.crans.info.services.acme;
inherit (lib) mkEnableOption mkIf;
inherit (lib) mkIf;
in
{
options.crans.services.acme = {
enable = mkEnableOption "Activer les certificats ACME via let's encrypt.";
};
# Options : ../info/acme.nix
config = mkIf cfg.enable {
age.secrets = {
acme-env.file = ../../secrets/acme/env.age;

View File

@ -1,5 +1,8 @@
{ lib, config, ... }:
let
cfg = config.crans.info.monitoring;
in
{
services.nginx = lib.mkIf config.services.nginx.enable {
recommendedProxySettings = true;
@ -15,7 +18,7 @@
real_ip_header X-Real-Ip;
'';
virtualHosts.nginx-stub-status = lib.mkIf config.crans.monitoring.enable {
virtualHosts.nginx-stub-status = lib.mkIf (cfg.enable && cfg.nginx.enable) {
listen = [
{
addr = "[::1]";