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.
131 lines
4.3 KiB
Nix
131 lines
4.3 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
inherit (lib) mkEnableOption mkIf mkMerge mkOption singleton types;
|
|
cfg = config.r6d.config-generator;
|
|
pfl = config.r6d.profiles;
|
|
host = config.networking.hostName;
|
|
in
|
|
|
|
{
|
|
imports = [
|
|
./activation-manuelle/auto-upgrade.nix
|
|
./activation-manuelle/locate.nix
|
|
./activation-manuelle/nix-serve.nix
|
|
./activation-manuelle/nix-serve-client.nix
|
|
./activation-manuelle/swap.nix
|
|
];
|
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
#* Utilisé pour afecter des capacités aux machines
|
|
r6d.profiles = {
|
|
# Domaine
|
|
isDubronetwork = mkEnableOption "Pour distinguer les machines dubronetwork";
|
|
isPrunetwork = mkEnableOption "Pour distinguer les machines prunetwork";
|
|
# Utilisation machine
|
|
isServer = mkEnableOption "Pour indiquer qu'il s'agit d'un serveur";
|
|
isDesktop = mkEnableOption "Pour indiquer une machine avec interface graphique.";
|
|
isWorkstation = mkEnableOption "Pour indiquer que la machine sert à travailler";
|
|
isHome = mkEnableOption "Pour indiquer que la machine sert à la maison (divertissement & autre)";
|
|
};
|
|
|
|
#* Utilisé dans les fichiers .nix
|
|
r6d.config-generator = {
|
|
enable = mkEnableOption "Generation de la configuration d'une machine";
|
|
auto-upgrade = mkEnableOption "Profil pour activer les mises à jour automatiques.";
|
|
docker = mkEnableOption "Profil pour l'utilisation de Docker";
|
|
jeux = mkEnableOption "Profil pour les jeux vidéos.";
|
|
laptop = mkEnableOption "Profil pour les outils spécifiques aux ordinateurs portables..";
|
|
locate = mkEnableOption "Profil pour activer la fonction locate.";
|
|
nix-serve-client= mkEnableOption "Profil pour que la machine soit un serveur de cache nix.";
|
|
nix-serve-server= mkEnableOption "Profil pour que la machine soit un serveur de cache nix.";
|
|
swap = mkEnableOption "Profil pour que le swap soit activé.";
|
|
virtualbox = mkEnableOption "Profil pour l'utilisation de VirtualBox.";
|
|
};
|
|
};
|
|
|
|
###### 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
|
|
[ # Unconditional stuff.
|
|
{
|
|
#environment.systemPackages = [ ... ];
|
|
r6d.config-generator.enable = true;
|
|
}
|
|
|
|
# Conditional stuff.
|
|
## Affectation des profils aux machines
|
|
(mkIf (host == "radx.prunetwork.fr") {
|
|
r6d.profiles.isHome = true;
|
|
r6d.profiles.isPrunetwork = true;
|
|
r6d.profiles.isServer = true;
|
|
r6d.profiles.isWorkstation = true;
|
|
|
|
r6d.config-generator = {
|
|
virtualbox = true;
|
|
};
|
|
})
|
|
|
|
(mkIf (host == "latitude.dubronetwork.fr") {
|
|
r6d.profiles.isDubronetwork = true;
|
|
r6d.profiles.isHome = true;
|
|
r6d.profiles.isWorkstation = true;
|
|
|
|
r6d.config-generator = {
|
|
laptop = true;
|
|
};
|
|
})
|
|
(mkIf (host == "monstre.dubronetwork.fr") {
|
|
r6d.profiles.isDubronetwork = true;
|
|
r6d.profiles.isServer = true;
|
|
})
|
|
(mkIf (host == "neo-nomade.dubronetwork.fr") {
|
|
r6d.profiles.isDubronetwork = true;
|
|
r6d.profiles.isHome = true;
|
|
|
|
r6d.config-generator = {
|
|
laptop = true;
|
|
};
|
|
})
|
|
(mkIf (host == "phenom.dubronetwork.fr") {
|
|
r6d.profiles.isDubronetwork = true;
|
|
r6d.profiles.isHome = true;
|
|
r6d.profiles.isWorkstation = true;
|
|
})
|
|
|
|
## Contenu des Profils
|
|
(mkIf pfl.isHome {
|
|
r6d.profiles.isDesktop = true;
|
|
|
|
#r6d.config-generator.jeux = true;
|
|
})
|
|
(mkIf pfl.isServer {
|
|
r6d.config-generator.nix-serve-server = true;
|
|
})
|
|
(mkIf pfl.isWorkstation {
|
|
r6d.profiles.isDesktop = true;
|
|
|
|
r6d.config-generator.docker = true;
|
|
})
|
|
(mkIf pfl.isPrunetwork {
|
|
r6d.config-generator.auto-upgrade = true;
|
|
r6d.config-generator.swap = true;
|
|
})
|
|
(mkIf pfl.isDubronetwork {
|
|
r6d.config-generator.auto-upgrade = true;
|
|
r6d.config-generator.nix-serve-client = true;
|
|
})
|
|
(mkIf (pfl.isDubronetwork && pfl.isServer) {
|
|
r6d.config-generator.nix-serve-server = true;
|
|
})
|
|
(mkIf (pfl.isDubronetwork && pfl.isWorkstation) {
|
|
r6d.config-generator.nix-serve-server = true;
|
|
r6d.config-generator.virtualbox = true;
|
|
})
|
|
];
|
|
}
|