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.
126 lines
2.7 KiB
Nix
126 lines
2.7 KiB
Nix
9 years ago
|
{ 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;
|
||
|
nix-serve-server = true;
|
||
|
swap = true;
|
||
|
};
|
||
|
})
|
||
|
|
||
|
(mkIf (config.networking.hostName == "phenom.dubronetwork.fr") {
|
||
|
r6d.config-generator = {
|
||
|
docker = true;
|
||
|
jeux = true;
|
||
|
nix-serve-server = true;
|
||
|
virtualbox = true;
|
||
|
};
|
||
|
})
|
||
|
|
||
|
## Contenu des Profils
|
||
|
# -> voir les sources des dépots base & desktop
|
||
|
];
|
||
|
}
|