Compare commits
10 Commits
2016-06-30
...
2016-07-09
| Author | SHA1 | Date | |
|---|---|---|---|
| 2fa21f7f4d | |||
| 0bbddfbfa0 | |||
| 85ee98585b | |||
| 61d0c565ea | |||
| 0a8c503032 | |||
| 3d1feebee0 | |||
| d03f8cbfc2 | |||
| b277551d6a | |||
|
|
87a0a9d3de | ||
|
|
aae5d9a4cc |
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
# Automatic update & automatic clean
|
# 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 = [
|
imports = [
|
||||||
];
|
];
|
||||||
|
|
||||||
services.locate= {
|
services.locate = {
|
||||||
enable = true;
|
enable = config.r6d.config-generator.locate;
|
||||||
interval = "hourly";
|
interval = "hourly";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
9
activation-manuelle/nix-serve-client.nix
Normal file
9
activation-manuelle/nix-serve-client.nix
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
nix = pkgs.lib.mkIf config.r6d.config-generator.nix-serve-client {
|
||||||
|
# Cache http pour le store
|
||||||
|
requireSignedBinaryCaches = false;
|
||||||
|
binaryCaches = [ "http://192.168.10.169:5000" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
8
activation-manuelle/nix-serve.nix
Normal file
8
activation-manuelle/nix-serve.nix
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Cache http pour le store
|
||||||
|
|
||||||
|
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, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
# Gestion du swap
|
||||||
|
|
||||||
# https://en.wikipedia.org/wiki/Swappiness
|
# 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 activé (!= 0)
|
||||||
# le swap est utilisé lorsque (100 - x) % de la mémoire est déja allouée
|
# le swap est utilisé lorsque (100 - x) % de la mémoire est déja allouée
|
||||||
"vm.swappiness" = 10;
|
"vm.swappiness" = 10;
|
||||||
|
|||||||
11
base.nix
11
base.nix
@@ -2,12 +2,17 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
#./activation-manuelle/auto-upgrade.nix
|
|
||||||
#./activation-manuelle/locate.nix
|
|
||||||
#./activation-manuelle/swap.nix
|
|
||||||
./environment.nix
|
./environment.nix
|
||||||
./localisation.nix
|
./localisation.nix
|
||||||
./networking.nix
|
./networking.nix
|
||||||
./services.nix
|
./services.nix
|
||||||
|
|
||||||
|
# inclusion conditionnelle
|
||||||
|
./config-generator.nix
|
||||||
|
./activation-manuelle/auto-upgrade.nix
|
||||||
|
./activation-manuelle/locate.nix
|
||||||
|
./activation-manuelle/nix-serve.nix
|
||||||
|
./activation-manuelle/nix-serve-client.nix
|
||||||
|
./activation-manuelle/swap.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
153
config-generator.nix
Normal file
153
config-generator.nix
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
{ 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-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é.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
|
nix-serve-client = true;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(mkIf (config.networking.hostName == "monstre.dubronetwork.fr") {
|
||||||
|
r6d.config-generator = {
|
||||||
|
nix-serve-server = true;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(mkIf (config.networking.hostName == "neo-nomade.dubronetwork.fr") {
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
## Contenu des Profils
|
||||||
|
# -> voir les sources des dépots base & desktop
|
||||||
|
];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user