création de variable nix pour identifier les machines

extraction-donnees-privees
Jean-Pierre PRUNARET 9 years ago
parent 522131a517
commit cd18fb2792

@ -5,6 +5,7 @@ let
inherit (lib) mkEnableOption mkIf mkMerge mkOption singleton types;
cfg = config.r6d.config-generator;
pfl = config.r6d.profiles;
comp = config.r6d.computers;
host = config.networking.hostName;
in
@ -48,6 +49,14 @@ in
swap = mkEnableOption "Profil pour que le swap soit activé.";
virtualbox = mkEnableOption "Profil pour l'utilisation de VirtualBox.";
};
#* Utilisé pour avoir des raccourcis de machine
r6d.computers = {
isLatitude = mkEnableOption "Identification du nom de machine.";
isMonstre = mkEnableOption "Identification du nom de machine.";
isNeoNomade = mkEnableOption "Identification du nom de machine.";
isPhenom = mkEnableOption "Identification du nom de machine.";
isRadx = mkEnableOption "Identification du nom de machine.";
};
};
###### implementation
@ -56,8 +65,14 @@ in
config = mkMerge
[ # Unconditional stuff.
{
#environment.systemPackages = [ ... ];
r6d.config-generator.enable = true;
r6d.computers = {
isLatitude = host == "latitude.dubronetwork.fr";
isMonstre = host == "monstre.dubronetwork.fr";
isNeoNomade = host == "neo-nomade.dubronetwork.fr";
isPhenom = host == "phenom.dubronetwork.fr";
isRadx = host == "radx.prunetwork.fr";
};
}
# Conditional stuff
@ -99,7 +114,7 @@ in
## Affectation des profils aux machines
(mkIf (host == "radx.prunetwork.fr") {
(mkIf comp.isRadx {
r6d.profiles.isHome = true;
r6d.profiles.isPrunetwork = true;
r6d.profiles.isServer = true;
@ -110,7 +125,7 @@ in
};
})
(mkIf (host == "latitude.dubronetwork.fr") {
(mkIf comp.isLatitude {
r6d.profiles.isDubronetwork = true;
r6d.profiles.isHome = true;
r6d.profiles.isWorkstation = true;
@ -119,13 +134,13 @@ in
laptop = true;
};
})
(mkIf (host == "monstre.dubronetwork.fr") {
(mkIf comp.isMonstre {
r6d.profiles.isDubronetwork = true;
r6d.profiles.isServer = true;
r6d.config-generator.fail2ban = true;
})
(mkIf (host == "neo-nomade.dubronetwork.fr") {
(mkIf comp.isNeoNomade{
r6d.profiles.isDubronetwork = true;
r6d.profiles.isHome = true;
@ -133,7 +148,7 @@ in
laptop = true;
};
})
(mkIf (host == "phenom.dubronetwork.fr") {
(mkIf comp.isPhenom {
r6d.profiles.isDubronetwork = true;
r6d.profiles.isHome = true;
r6d.profiles.isWorkstation = true;

Loading…
Cancel
Save