Suppression de la double évaluation des info.nix

merge-requests/104/head
Pyjacpp 2026-11-11 18:32:37 +01:00
parent 1c4c776a1f
commit 58aad1b397
No known key found for this signature in database
GPG Key ID: ED479A5A26930939
9 changed files with 33 additions and 32 deletions

View File

@ -5,7 +5,7 @@
# secrets de turn.
#
{ config, pkgs, lib, ... }:
{ config, info, pkgs, lib, ... }:
let
keyFile = "/run/livekit.key";
@ -24,7 +24,7 @@ in
rtc = {
use_external_ip = false;
node_ip = config.crans.info.networking.srv.ipv4.address;
node_ip = info.networking.srv.ipv4.address;
tcp_port = 8101;
port_range_start = 50000;
port_range_end = 52000;

View File

@ -49,10 +49,10 @@ rec {
specialArgs = inputs // {
hosts = all_hosts;
crans = cransConfig;
inherit info;
};
modules = [
(path + "/${name}")
({ ... }: { config.crans.info = info; })
]
++ baseModules;
}

View File

@ -2,12 +2,11 @@
lib,
config,
crans,
info,
...
}:
let
cfg = config.crans.info;
inherit (lib)
mkOption
mkIf
@ -34,19 +33,13 @@ in
./virtualisation.nix
];
options.crans.info = mkOption {
type = types.submoduleWith {
modules = [ ../info ];
specialArgs = { inherit crans; };
};
description = "Informations de la machines (info.nix)";
};
# Options ../info/meta.nix
config = mkIf cfg.enable {
config = mkIf info.enable {
warnings = (
optional (
cfg.isVm != (cfg.id >= 100)
) "${cfg.name}: isVm (${toString cfg.isVm}) est incohérent avec son id (${toString cfg.id})"
info.isVm != (info.id >= 100)
) "${info.name}: isVm (${toString info.isVm}) est incohérent avec son id (${toString info.id})"
);
};
}

View File

@ -1,8 +1,6 @@
{ lib, config, ... }:
{ lib, info, ... }:
let
cfg = config.crans.info;
inherit (lib) mkIf;
in
@ -10,7 +8,7 @@ in
# Options ../info/home.nix
config = {
fileSystems = {
home_nounou = mkIf cfg.homeNounou.enable {
home_nounou = mkIf info.homeNounou.enable {
mountPoint = "/home_nounou";
device = "172.16.10.1:/pool/home";
fsType = "nfs";
@ -20,7 +18,7 @@ in
];
};
home_adh = mkIf cfg.homeAdh.enable {
home_adh = mkIf info.homeAdh.enable {
mountPoint = "/home-adh";
device = "172.16.4.2:/pool/home";
fsType = "nfs";

View File

@ -1,11 +1,12 @@
{
config,
info,
lib,
...
}:
let
cfg = config.crans.info.monitoring;
cfg = info.monitoring;
nginxEnable = config.services.nginx.enable;
inherit (lib) mkIf optional;
@ -18,7 +19,7 @@ in
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})
${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})
'';
services.prometheus.exporters = mkIf cfg.enable {

View File

@ -1,13 +1,12 @@
{
lib,
config,
crans,
info,
...
}:
let
cfg = config.crans.info;
cfg-net = cfg.networking;
cfg-net = info.networking;
inherit (lib)
mkIf
@ -21,7 +20,7 @@ in
# Options ../info/networking.nix
config = mkIf cfg-net.enable {
networking = {
hostName = cfg.name;
hostName = info.name;
useDHCP = false;
firewall.enable = mkDefault false;
nameservers = [

View File

@ -1,7 +1,12 @@
{ config, lib, ... }:
{
config,
info,
lib,
...
}:
let
cfg = config.crans.info.resticClient;
cfg = info.resticClient;
inherit (lib) mkIf;
in

View File

@ -1,6 +1,6 @@
{ config, ... }:
{ config, info, ... }:
let
cfg = config.crans.info.users;
cfg = info.users;
in
{
# Options : ../info/users.nix

View File

@ -1,7 +1,12 @@
{ lib, config, ... }:
{
lib,
config,
info,
...
}:
let
cfg = config.crans.info.monitoring;
cfg = info.monitoring;
in
{
services.nginx = lib.mkIf config.services.nginx.enable {