|
|
|
@ -3,6 +3,8 @@
|
|
|
|
|
let
|
|
|
|
|
inherit (lib) mkEnableOption mkIf mkMerge mkOption singleton types;
|
|
|
|
|
cfg = config.r6d.config-generator;
|
|
|
|
|
pfl = config.r6d.profiles;
|
|
|
|
|
host = config.networking.hostName;
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
@ -18,85 +20,33 @@ in
|
|
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
|
|
r6d.config-generator = {
|
|
|
|
|
|
|
|
|
|
enable = mkEnableOption "Generation de la configuration d'une machine";
|
|
|
|
|
|
|
|
|
|
auto-upgrade = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = true;
|
|
|
|
|
description = ''
|
|
|
|
|
Profil pour activer les mises à jour automatiques.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
docker = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Profil pour l'utilisation de Docker.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
jeux = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Profil pour les jeux vidéos.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
laptop = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Profil pour les outils spécifiques aux ordinateurs portables..
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
locate = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = true;
|
|
|
|
|
description = ''
|
|
|
|
|
Profil pour activer la fonction locate.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
nix-serve-client = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Profil pour que la machine soit un serveur de cache nix.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
nix-serve-server = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Profil pour que la machine soit un serveur de cache nix.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
swap = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Profil pour que le swap soit activé.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
#* 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)";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
virtualbox = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Profil pour l'utilisation de VirtualBox.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
#* 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
|
|
|
|
@ -109,46 +59,72 @@ in
|
|
|
|
|
|
|
|
|
|
# Conditional stuff.
|
|
|
|
|
## Affectation des profils aux machines
|
|
|
|
|
(mkIf (config.networking.hostName == "radx.prunetwork.fr") {
|
|
|
|
|
(mkIf (host == "radx.prunetwork.fr") {
|
|
|
|
|
r6d.profiles.isHome = true;
|
|
|
|
|
r6d.profiles.isPrunetwork = true;
|
|
|
|
|
r6d.profiles.isServer = true;
|
|
|
|
|
r6d.profiles.isWorkstation = true;
|
|
|
|
|
|
|
|
|
|
r6d.config-generator = {
|
|
|
|
|
docker = true;
|
|
|
|
|
jeux = true;
|
|
|
|
|
nix-serve-server = true;
|
|
|
|
|
swap = true;
|
|
|
|
|
virtualbox = true;
|
|
|
|
|
};
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
(mkIf (config.networking.hostName == "latitude.dubronetwork.fr") {
|
|
|
|
|
(mkIf (host == "latitude.dubronetwork.fr") {
|
|
|
|
|
r6d.profiles.isDubronetwork = true;
|
|
|
|
|
r6d.profiles.isHome = true;
|
|
|
|
|
r6d.profiles.isWorkstation = true;
|
|
|
|
|
|
|
|
|
|
r6d.config-generator = {
|
|
|
|
|
docker = true;
|
|
|
|
|
jeux = true;
|
|
|
|
|
laptop = true;
|
|
|
|
|
nix-serve-client = true;
|
|
|
|
|
};
|
|
|
|
|
})
|
|
|
|
|
(mkIf (config.networking.hostName == "monstre.dubronetwork.fr") {
|
|
|
|
|
r6d.config-generator = {
|
|
|
|
|
nix-serve-server = true;
|
|
|
|
|
};
|
|
|
|
|
(mkIf (host == "monstre.dubronetwork.fr") {
|
|
|
|
|
r6d.profiles.isDubronetwork = true;
|
|
|
|
|
r6d.profiles.isServer = true;
|
|
|
|
|
})
|
|
|
|
|
(mkIf (config.networking.hostName == "neo-nomade.dubronetwork.fr") {
|
|
|
|
|
(mkIf (host == "neo-nomade.dubronetwork.fr") {
|
|
|
|
|
r6d.profiles.isDubronetwork = true;
|
|
|
|
|
r6d.profiles.isHome = true;
|
|
|
|
|
|
|
|
|
|
r6d.config-generator = {
|
|
|
|
|
laptop = true;
|
|
|
|
|
nix-serve-client = true;
|
|
|
|
|
};
|
|
|
|
|
})
|
|
|
|
|
(mkIf (config.networking.hostName == "phenom.dubronetwork.fr") {
|
|
|
|
|
r6d.config-generator = {
|
|
|
|
|
docker = true;
|
|
|
|
|
jeux = true;
|
|
|
|
|
nix-serve-client = true;
|
|
|
|
|
nix-serve-server = true;
|
|
|
|
|
virtualbox = true;
|
|
|
|
|
};
|
|
|
|
|
(mkIf (host == "phenom.dubronetwork.fr") {
|
|
|
|
|
r6d.profiles.isDubronetwork = true;
|
|
|
|
|
r6d.profiles.isHome = true;
|
|
|
|
|
r6d.profiles.isWorkstation = true;
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Contenu des Profils
|
|
|
|
|
# -> voir les sources des dépots base & desktop
|
|
|
|
|
(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;
|
|
|
|
|
})
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|