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.
nixos-template-base/config-generator.nix

90 lines
2.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é
8 years ago
###### interface
8 years ago
options = {
#* Utilisé pour avoir des raccourcis de machine
r6d.computers = {
isNomade = 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;
};
})
## Affectation des profils aux machines
# 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.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
8 years ago
'';
virtualbox = true;
9 years ago
znc = true;
};
})
];
}