Merge branch 'generator'

extraction-donnees-privees
Jean-Pierre PRUNARET 9 years ago
commit 61d0c565ea

@ -2,6 +2,7 @@
{
# Automatic update & automatic clean
system.autoUpgrade.enable = true;
nix.gc.automatic = true;
system.autoUpgrade.enable = config.r6d.config-generator.auto-upgrade;
nix.gc.automatic = config.r6d.config-generator.auto-upgrade;
}

@ -4,8 +4,8 @@
imports = [
];
services.locate= {
enable = true;
services.locate = {
enable = config.r6d.config-generator.locate;
interval = "hourly";
};
}

@ -2,6 +2,7 @@
{
# Cache http pour le store
services.nix-serve.enable = true;
networking.firewall.allowedTCPPorts = [5000];
services.nix-serve.enable = config.r6d.config-generator.nix-serve-server;
networking.firewall.allowedTCPPorts = pkgs.lib.mkIf config.r6d.config-generator.nix-serve-server [5000];
}

@ -1,9 +1,10 @@
{ config, pkgs, ... }:
{
# Gestion du swap
# https://en.wikipedia.org/wiki/Swappiness
boot.kernel.sysctl = {
boot.kernel.sysctl = pkgs.lib.mkIf config.r6d.config-generator.swap {
# le swap est activé (!= 0)
# le swap est utilisé lorsque (100 - x) % de la mémoire est déja allouée
"vm.swappiness" = 10;

@ -2,12 +2,16 @@
{
imports = [
#./activation-manuelle/auto-upgrade.nix
#./activation-manuelle/locate.nix
#./activation-manuelle/swap.nix
./environment.nix
./localisation.nix
./networking.nix
./services.nix
# inclusion conditionnelle
./config-generator.nix
./activation-manuelle/auto-upgrade.nix
./activation-manuelle/locate.nix
./activation-manuelle/nix-serve.nix
./activation-manuelle/swap.nix
];
}

@ -0,0 +1,137 @@
{ 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 == "latitude.dubronetwork.fr") {
r6d.config-generator = {
docker = true;
jeux = true;
laptop = true;
};
})
(mkIf (config.networking.hostName == "nro-nomade.dubronetwork.fr") {
r6d.config-generator = {
laptop = 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
];
}
Loading…
Cancel
Save