You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
190 lines
5.4 KiB
Nix
190 lines
5.4 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
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;
|
|
annuaire = config.r6d.machines;
|
|
currentMachine = annuaire."${config.networking.hostName}";
|
|
flags = currentMachine.configurationFlags;
|
|
in
|
|
|
|
{
|
|
# TODO camel case partout
|
|
# TODO everything in english
|
|
# TODO sortir ce qui est privé
|
|
# TODO portage du système d'annuaire de machines de capgemini
|
|
###### interface
|
|
|
|
options = {
|
|
#* 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.";
|
|
isNomade = mkEnableOption "Identification du nom de machine.";
|
|
isPedro = mkEnableOption "Identification du nom de machine.";
|
|
isPhenom = mkEnableOption "Identification du nom de machine.";
|
|
isRollo = mkEnableOption "Identification du nom de machine.";
|
|
};
|
|
};
|
|
|
|
###### implementation
|
|
# https://nixos.org/releases/nixos/14.12-small/nixos-14.12.374.61adf9e/manual/sec-writing-modules.html
|
|
# https://nixos.org/wiki/NixOS:extend_NixOS
|
|
config = mkMerge
|
|
[
|
|
## Définition des profils génériques
|
|
(mkIf (pfl.isServer && !comp.isMonstre) {
|
|
r6d.config-generator = {
|
|
#database_postgres = true;
|
|
dns_autorite = true;
|
|
#dns_resolveur = true;
|
|
# inutile d'exposer la conf complète du serveur par le store tant qu'il n'y a pas de protection complémentaire - utilisation SSH ?
|
|
#nix-serve-server = true;
|
|
smokeping = true;
|
|
|
|
#rabbitmq = true;
|
|
};
|
|
})
|
|
# /!\ PAS un serveur
|
|
(mkIf (!pfl.isServer || comp.isMonstre) {
|
|
r6d.config-generator = {
|
|
dns_resolveur = true;
|
|
};
|
|
})
|
|
|
|
## Profils liés à Dubronetwork
|
|
(mkIf (pfl.isDubronetwork && pfl.isWorkstation) {
|
|
r6d.config-generator = {
|
|
cartographie = true;
|
|
conception-assistee = true;
|
|
docker = true;
|
|
developpement = true;
|
|
developpement-elm = true;
|
|
developpement-haskell = true;
|
|
developpement-java = true;
|
|
developpement-rust = true;
|
|
edition-musique = true;
|
|
edition-photo = true;
|
|
edition-video = true;
|
|
scanner = true;
|
|
virtualbox = true;
|
|
xmonad = true;
|
|
};
|
|
})
|
|
|
|
## Affectation des profils aux machines
|
|
|
|
(mkIf comp.isLatitude {
|
|
networking.hostName = "latitude.dubronetwork.fr"; # Define your hostname.
|
|
r6d.profiles = {
|
|
isDubronetwork = true;
|
|
isWorkstation = true;
|
|
};
|
|
|
|
r6d.config-generator = {
|
|
jetbrains-licensed = true;
|
|
laptop = true;
|
|
nix-serve-client = true;
|
|
nix-serve-server = true;
|
|
tincAddress = "192.168.12.2/24";
|
|
tincExtraConfig = ''
|
|
ConnectTo = monstre_dubronetwork_fr
|
|
ConnectTo = rollo_dubronetwork_fr
|
|
ConnectTo = hydra_prunetwork_fr
|
|
ConnectTo = ocean_prunetwork_fr
|
|
'';
|
|
};
|
|
})
|
|
|
|
(mkIf comp.isNeoNomade{
|
|
networking.hostName = "neo-nomade.dubronetwork.fr"; # Define your hostname.
|
|
r6d.profiles = {
|
|
isDubronetwork = true;
|
|
isDesktopEnvironment = true;
|
|
};
|
|
|
|
r6d.config-generator = {
|
|
laptop = true;
|
|
graphical = true;
|
|
scanner = true;
|
|
tincAddress = "192.168.12.7/24";
|
|
tincExtraConfig = ''
|
|
ConnectTo = monstre_dubronetwork_fr
|
|
ConnectTo = rollo_dubronetwork_fr
|
|
ConnectTo = hydra_prunetwork_fr
|
|
ConnectTo = ocean_prunetwork_fr
|
|
'';
|
|
};
|
|
})
|
|
# Dubro Vivo - St Malo
|
|
#tincAddress = "192.168.12.8/24";
|
|
(mkIf comp.isNomade{
|
|
networking.hostName = "nomade.dubronetwork.fr"; # Define your hostname.
|
|
r6d.profiles.isDubronetwork = true;
|
|
|
|
r6d.config-generator = {
|
|
laptop = true;
|
|
};
|
|
})
|
|
(mkIf comp.isPedro {
|
|
r6d.profiles = {
|
|
isDubronetwork = true;
|
|
isServer = true;
|
|
};
|
|
|
|
r6d.config-generator = {
|
|
fail2ban = true;
|
|
};
|
|
})
|
|
(mkIf comp.isPhenom {
|
|
networking.hostName = "phenom.dubronetwork.fr"; # Define your hostname.
|
|
r6d.profiles = {
|
|
isDubronetwork = true;
|
|
isWorkstation = true;
|
|
};
|
|
|
|
r6d.config-generator = {
|
|
jetbrains-licensed = true;
|
|
#hydra-core = true;
|
|
nix-serve-client = true;
|
|
nix-serve-server = true;
|
|
edition-photo = true;
|
|
tincAddress = "192.168.12.1/24";
|
|
tincExtraConfig = ''
|
|
ConnectTo = monstre_dubronetwork_fr
|
|
ConnectTo = rollo_dubronetwork_fr
|
|
ConnectTo = hydra_prunetwork_fr
|
|
ConnectTo = ocean_prunetwork_fr
|
|
'';
|
|
};
|
|
})
|
|
(mkIf comp.isRollo {
|
|
networking.hostName = "rollo.dubronetwork.fr"; # Define your hostname.
|
|
r6d.profiles = {
|
|
isDubronetwork = true;
|
|
isServer = true;
|
|
};
|
|
|
|
r6d.config-generator = {
|
|
dovecot = true;
|
|
fail2ban = true;
|
|
mailboxes = true;
|
|
murmur = true;
|
|
nix-serve-client = true;
|
|
nix-serve-server = true;
|
|
tincAddress = "192.168.12.5/24";
|
|
tincExtraConfig = ''
|
|
ConnectTo = hydra_prunetwork_fr
|
|
ConnectTo = ocean_prunetwork_fr
|
|
'';
|
|
virtualbox = true;
|
|
znc = true;
|
|
};
|
|
})
|
|
];
|
|
}
|