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

55 lines
1.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é
###### interface
options = {
#* Utilisé pour avoir des raccourcis de machine
r6d.computers = {
isNomade = 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
# /!\ 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;
};
})
];
}