moulinette de configuration par flags de fonctionalité
							parent
							
								
									aae5d9a4cc
								
							
						
					
					
						commit
						b277551d6a
					
				@ -0,0 +1,129 @@
 | 
				
			|||||||
 | 
					{ config, lib, pkgs, ... }:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					let
 | 
				
			||||||
 | 
					  inherit (lib) mkEnableOption mkIf mkMerge mkOption singleton types;
 | 
				
			||||||
 | 
					  #inherit (pkgs) bird;
 | 
				
			||||||
 | 
					  cfg = config.r6d.config-generator;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #  configFile = pkgs.writeText "bird.conf" ''
 | 
				
			||||||
 | 
					  #    ${cfg.config}
 | 
				
			||||||
 | 
					  #'';
 | 
				
			||||||
 | 
					in
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  imports = [
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ###### interface
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  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-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é.
 | 
				
			||||||
 | 
					        '';
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      virtualbox = mkOption {
 | 
				
			||||||
 | 
					        type = types.bool;
 | 
				
			||||||
 | 
					        default = false;
 | 
				
			||||||
 | 
					        description = ''
 | 
				
			||||||
 | 
					          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 (config.networking.hostName == "radx.prunetwork.fr") {
 | 
				
			||||||
 | 
					      r6d.config-generator = {
 | 
				
			||||||
 | 
					        docker = true;
 | 
				
			||||||
 | 
					        jeux = true;
 | 
				
			||||||
 | 
					        laptop = true;
 | 
				
			||||||
 | 
					        nix-serve-server = true;
 | 
				
			||||||
 | 
					        swap = true;
 | 
				
			||||||
 | 
					        virtualbox = true;
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    (mkIf (config.networking.hostName == "phenom.dubronetwork.fr") {
 | 
				
			||||||
 | 
					      r6d.config-generator = {
 | 
				
			||||||
 | 
					        docker = true;
 | 
				
			||||||
 | 
					        jeux = true;
 | 
				
			||||||
 | 
					        laptop = true;
 | 
				
			||||||
 | 
					        nix-serve-server = true;
 | 
				
			||||||
 | 
					        swap = true;
 | 
				
			||||||
 | 
					        virtualbox = true;
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ## Contenu des Profils
 | 
				
			||||||
 | 
					    # -> voir les sources des dépots base & desktop
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
					Loading…
					
					
				
		Reference in New Issue