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

View File

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

View File

@ -2,12 +2,11 @@
lib, lib,
config, config,
crans, crans,
info,
... ...
}: }:
let let
cfg = config.crans.info;
inherit (lib) inherit (lib)
mkOption mkOption
mkIf mkIf
@ -34,19 +33,13 @@ in
./virtualisation.nix ./virtualisation.nix
]; ];
options.crans.info = mkOption { # Options ../info/meta.nix
type = types.submoduleWith {
modules = [ ../info ];
specialArgs = { inherit crans; };
};
description = "Informations de la machines (info.nix)";
};
config = mkIf cfg.enable { config = mkIf info.enable {
warnings = ( warnings = (
optional ( optional (
cfg.isVm != (cfg.id >= 100) info.isVm != (info.id >= 100)
) "${cfg.name}: isVm (${toString cfg.isVm}) est incohérent avec son id (${toString cfg.id})" ) "${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 let
cfg = config.crans.info;
inherit (lib) mkIf; inherit (lib) mkIf;
in in
@ -10,7 +8,7 @@ in
# Options ../info/home.nix # Options ../info/home.nix
config = { config = {
fileSystems = { fileSystems = {
home_nounou = mkIf cfg.homeNounou.enable { home_nounou = mkIf info.homeNounou.enable {
mountPoint = "/home_nounou"; mountPoint = "/home_nounou";
device = "172.16.10.1:/pool/home"; device = "172.16.10.1:/pool/home";
fsType = "nfs"; fsType = "nfs";
@ -20,7 +18,7 @@ in
]; ];
}; };
home_adh = mkIf cfg.homeAdh.enable { home_adh = mkIf info.homeAdh.enable {
mountPoint = "/home-adh"; mountPoint = "/home-adh";
device = "172.16.4.2:/pool/home"; device = "172.16.4.2:/pool/home";
fsType = "nfs"; fsType = "nfs";

View File

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

View File

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

View File

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

View File

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

View File

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