Compare commits
15 Commits
2016-07-10
...
2016-07-21
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
111f33ff3d | ||
| 28f65522ae | |||
|
|
b7f05e47ac | ||
|
|
350b62aef2 | ||
|
|
f6b939ffa9 | ||
|
|
aa48575f58 | ||
| a920200904 | |||
| 9cce1410a0 | |||
| 9499034120 | |||
| 2c715f9e14 | |||
| cd18fb2792 | |||
| 522131a517 | |||
| cfc55fa479 | |||
| 81ad043adb | |||
| a475a88ac4 |
33
activation-manuelle/fail2ban.nix
Normal file
33
activation-manuelle/fail2ban.nix
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Gestion de fail2ban
|
||||||
|
|
||||||
|
services = pkgs.lib.mkIf config.r6d.config-generator.fail2ban {
|
||||||
|
fail2ban = {
|
||||||
|
enable = true;
|
||||||
|
jails = {
|
||||||
|
DEFAULT = ''
|
||||||
|
# "ignoreip" can be an IP address, a CIDR mask or a DNS host
|
||||||
|
ignoreip = 127.0.0.1/8 pedro.dubronetwork.fr cube.dubronetwork.fr voyage.prunetwork.fr xray.prunetwork.fr 192.168.0.0/16 172.16.0.0/16
|
||||||
|
|
||||||
|
# 1 jour
|
||||||
|
# bantime = 86400
|
||||||
|
# 5 jours
|
||||||
|
bantime = 432000
|
||||||
|
maxretry = 3
|
||||||
|
|
||||||
|
#
|
||||||
|
# Destination email address used solely for the interpolations in
|
||||||
|
# jail.{conf,local} configuration files.
|
||||||
|
destemail = admins@dubronetwork.fr
|
||||||
|
'';
|
||||||
|
ssh-route = ''
|
||||||
|
filter = sshd
|
||||||
|
action = route[blocktype=blackhole]
|
||||||
|
maxretry = 3
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
activation-manuelle/laptop.nix
Normal file
6
activation-manuelle/laptop.nix
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Gestion spécifique pour PC portable
|
||||||
|
powerManagement.cpuFreqGovernor = pkgs.lib.mkIf config.r6d.config-generator.laptop "powersave";
|
||||||
|
}
|
||||||
@@ -2,12 +2,16 @@
|
|||||||
let
|
let
|
||||||
inherit (lib) mkIf mkMerge;
|
inherit (lib) mkIf mkMerge;
|
||||||
profiles = config.r6d.profiles;
|
profiles = config.r6d.profiles;
|
||||||
|
computers = config.r6d.computers;
|
||||||
in {
|
in {
|
||||||
nix = mkIf config.r6d.config-generator.nix-serve-client {
|
nix = mkIf config.r6d.config-generator.nix-serve-client {
|
||||||
# Cache http pour le store
|
# Cache http pour le store
|
||||||
requireSignedBinaryCaches = false;
|
requireSignedBinaryCaches = false;
|
||||||
binaryCaches = [
|
binaryCaches = [
|
||||||
(mkIf profiles.isDubronetwork "http://192.168.10.169:5000")
|
("https://cache.nixos.org/")
|
||||||
|
(mkIf (profiles.isDubronetwork && (! computers.isMonstre)) "http://192.168.10.169:5000")
|
||||||
|
(mkIf profiles.isDubronetwork "http://192.168.10.252:5000")
|
||||||
|
|
||||||
(mkIf profiles.isPrunetwork "http://192.168.1.20:5000")
|
(mkIf profiles.isPrunetwork "http://192.168.1.20:5000")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,63 +5,88 @@ let
|
|||||||
inherit (lib) mkEnableOption mkIf mkMerge mkOption singleton types;
|
inherit (lib) mkEnableOption mkIf mkMerge mkOption singleton types;
|
||||||
cfg = config.r6d.config-generator;
|
cfg = config.r6d.config-generator;
|
||||||
pfl = config.r6d.profiles;
|
pfl = config.r6d.profiles;
|
||||||
|
comp = config.r6d.computers;
|
||||||
host = config.networking.hostName;
|
host = config.networking.hostName;
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./activation-manuelle/auto-upgrade.nix
|
./activation-manuelle/auto-upgrade.nix
|
||||||
./activation-manuelle/locate.nix
|
./activation-manuelle/laptop.nix
|
||||||
./activation-manuelle/nix-serve-client.nix
|
./activation-manuelle/locate.nix
|
||||||
./activation-manuelle/nix-serve-server.nix
|
./activation-manuelle/fail2ban.nix
|
||||||
./activation-manuelle/swap.nix
|
./activation-manuelle/nix-serve-client.nix
|
||||||
];
|
./activation-manuelle/nix-serve-server.nix
|
||||||
|
./activation-manuelle/swap.nix
|
||||||
|
];
|
||||||
|
|
||||||
###### interface
|
###### interface
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
#* Utilisé pour afecter des capacités aux machines
|
#* Utilisé pour afecter des capacités aux machines
|
||||||
r6d.profiles = {
|
r6d.profiles = {
|
||||||
# Domaine
|
# Domaine
|
||||||
isDubronetwork = mkEnableOption "Pour distinguer les machines dubronetwork.";
|
isDubronetwork = mkEnableOption "Pour distinguer les machines dubronetwork.";
|
||||||
isPrunetwork = mkEnableOption "Pour distinguer les machines prunetwork.";
|
isPrunetwork = mkEnableOption "Pour distinguer les machines prunetwork.";
|
||||||
# Utilisation machine
|
# Utilisation machine
|
||||||
isDesktop = mkEnableOption "Pour indiquer une machine avec interface graphique.";
|
isDesktop = mkEnableOption "Pour indiquer une machine avec interface graphique.";
|
||||||
isHome = mkEnableOption "Pour indiquer que la machine sert à la maison (divertissement & autre).";
|
isHome = mkEnableOption "Pour indiquer que la machine sert à la maison (divertissement & autre).";
|
||||||
isServer = mkEnableOption "Pour indiquer qu'il s'agit d'un serveur.";
|
isServer = mkEnableOption "Pour indiquer qu'il s'agit d'un serveur.";
|
||||||
isWorkstation = mkEnableOption "Pour indiquer que la machine sert à travailler.";
|
isWorkstation = mkEnableOption "Pour indiquer que la machine sert à travailler.";
|
||||||
|
};
|
||||||
|
|
||||||
|
#* Utilisé dans les fichiers .nix
|
||||||
|
r6d.config-generator = {
|
||||||
|
enable = mkEnableOption "Génération de la configuration d'une machine.";
|
||||||
|
awesome = mkEnableOption "Profil pour activer le gestionnaire de fenêtre awesome.";
|
||||||
|
auto-upgrade = mkEnableOption "Profil pour activer les mises à jour automatiques.";
|
||||||
|
docker = mkEnableOption "Profil pour l'utilisation de Docker.";
|
||||||
|
fail2ban = mkEnableOption "Profil pour activer Fail2ban.";
|
||||||
|
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.";
|
||||||
|
xmonad = mkEnableOption "Profil pour activer le gestionnaire de fenêtres xmonad.";
|
||||||
|
};
|
||||||
|
#* Utilisé pour avoir des raccourcis de machine
|
||||||
|
r6d.computers = {
|
||||||
|
isLatitude = mkEnableOption "Identification du nom de machine.";
|
||||||
|
isMonstre = mkEnableOption "Identification du nom de machine.";
|
||||||
|
isNeoNomade = mkEnableOption "Identification du nom de machine.";
|
||||||
|
isNomade = mkEnableOption "Identification du nom de machine.";
|
||||||
|
isPhenom = mkEnableOption "Identification du nom de machine.";
|
||||||
|
isRadx = mkEnableOption "Identification du nom de machine.";
|
||||||
|
isXray = mkEnableOption "Identification du nom de machine.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#* Utilisé dans les fichiers .nix
|
###### implementation
|
||||||
r6d.config-generator = {
|
# https://nixos.org/releases/nixos/14.12-small/nixos-14.12.374.61adf9e/manual/sec-writing-modules.html
|
||||||
enable = mkEnableOption "Génération de la configuration d'une machine.";
|
# https://nixos.org/wiki/NixOS:extend_NixOS
|
||||||
auto-upgrade = mkEnableOption "Profil pour activer les mises à jour automatiques.";
|
config = mkMerge
|
||||||
docker = mkEnableOption "Profil pour l'utilisation de Docker.";
|
[ # Unconditional stuff.
|
||||||
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
|
|
||||||
config = mkMerge
|
|
||||||
[ # Unconditional stuff.
|
|
||||||
{
|
{
|
||||||
#environment.systemPackages = [ ... ];
|
|
||||||
r6d.config-generator.enable = true;
|
r6d.config-generator.enable = true;
|
||||||
|
r6d.computers = {
|
||||||
|
isLatitude = host == "latitude.dubronetwork.fr";
|
||||||
|
isMonstre = host == "monstre.dubronetwork.fr";
|
||||||
|
isNeoNomade = host == "neo-nomade.dubronetwork.fr";
|
||||||
|
isNomade = host == "nomade.dubronetwork.fr";
|
||||||
|
isPhenom = host == "phenom.dubronetwork.fr";
|
||||||
|
isRadx = host == "radx.prunetwork.fr";
|
||||||
|
isXray = host == "xray.prunetwork.fr";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
# Conditional stuff
|
# Conditional stuff
|
||||||
|
|
||||||
## Définition des profils génériques
|
## Définition des profils génériques
|
||||||
(mkIf pfl.isDesktop {
|
(mkIf pfl.isDesktop {
|
||||||
|
r6d.config-generator.awesome = true;
|
||||||
})
|
})
|
||||||
(mkIf pfl.isHome {
|
(mkIf pfl.isHome {
|
||||||
r6d.profiles.isDesktop = true;
|
r6d.profiles.isDesktop = true;
|
||||||
@@ -71,10 +96,10 @@ in
|
|||||||
})
|
})
|
||||||
(mkIf pfl.isWorkstation {
|
(mkIf pfl.isWorkstation {
|
||||||
r6d.profiles.isDesktop = true;
|
r6d.profiles.isDesktop = true;
|
||||||
|
|
||||||
r6d.config-generator.docker = true;
|
r6d.config-generator.docker = true;
|
||||||
})
|
})
|
||||||
(mkIf pfl.isDubronetwork {
|
(mkIf pfl.isDubronetwork {
|
||||||
r6d.config-generator.auto-upgrade = true;
|
r6d.config-generator.auto-upgrade = true;
|
||||||
r6d.config-generator.nix-serve-client = true;
|
r6d.config-generator.nix-serve-client = true;
|
||||||
})
|
})
|
||||||
@@ -85,18 +110,18 @@ in
|
|||||||
r6d.config-generator.nix-serve-server = true;
|
r6d.config-generator.nix-serve-server = true;
|
||||||
})
|
})
|
||||||
(mkIf (pfl.isDubronetwork && pfl.isWorkstation) {
|
(mkIf (pfl.isDubronetwork && pfl.isWorkstation) {
|
||||||
r6d.config-generator.nix-serve-server = true;
|
|
||||||
r6d.config-generator.virtualbox = true;
|
r6d.config-generator.virtualbox = true;
|
||||||
})
|
})
|
||||||
(mkIf pfl.isPrunetwork {
|
(mkIf pfl.isPrunetwork {
|
||||||
r6d.config-generator.auto-upgrade = true;
|
r6d.config-generator.auto-upgrade = true;
|
||||||
|
r6d.config-generator.fail2ban = true;
|
||||||
r6d.config-generator.nix-serve-client = true;
|
r6d.config-generator.nix-serve-client = true;
|
||||||
r6d.config-generator.swap = true;
|
r6d.config-generator.swap = true;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
## Affectation des profils aux machines
|
## Affectation des profils aux machines
|
||||||
(mkIf (host == "radx.prunetwork.fr") {
|
(mkIf comp.isRadx {
|
||||||
r6d.profiles.isHome = true;
|
r6d.profiles.isHome = true;
|
||||||
r6d.profiles.isPrunetwork = true;
|
r6d.profiles.isPrunetwork = true;
|
||||||
r6d.profiles.isServer = true;
|
r6d.profiles.isServer = true;
|
||||||
@@ -106,21 +131,28 @@ in
|
|||||||
virtualbox = true;
|
virtualbox = true;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
(mkIf comp.isXray {
|
||||||
(mkIf (host == "latitude.dubronetwork.fr") {
|
r6d.profiles.isPrunetwork = true;
|
||||||
r6d.profiles.isDubronetwork = true;
|
|
||||||
r6d.profiles.isHome = true;
|
|
||||||
r6d.profiles.isWorkstation = true;
|
|
||||||
|
|
||||||
r6d.config-generator = {
|
|
||||||
laptop = true;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
(mkIf (host == "monstre.dubronetwork.fr") {
|
|
||||||
r6d.profiles.isDubronetwork = true;
|
|
||||||
r6d.profiles.isServer = true;
|
r6d.profiles.isServer = true;
|
||||||
})
|
})
|
||||||
(mkIf (host == "neo-nomade.dubronetwork.fr") {
|
|
||||||
|
(mkIf comp.isLatitude {
|
||||||
|
r6d.profiles.isDubronetwork = true;
|
||||||
|
r6d.profiles.isHome = true;
|
||||||
|
r6d.profiles.isWorkstation = true;
|
||||||
|
|
||||||
|
r6d.config-generator = {
|
||||||
|
laptop = true;
|
||||||
|
xmonad = true;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(mkIf comp.isMonstre {
|
||||||
|
r6d.profiles.isDubronetwork = true;
|
||||||
|
r6d.profiles.isServer = true;
|
||||||
|
|
||||||
|
r6d.config-generator.fail2ban = true;
|
||||||
|
})
|
||||||
|
(mkIf comp.isNeoNomade{
|
||||||
r6d.profiles.isDubronetwork = true;
|
r6d.profiles.isDubronetwork = true;
|
||||||
r6d.profiles.isHome = true;
|
r6d.profiles.isHome = true;
|
||||||
|
|
||||||
@@ -128,10 +160,20 @@ in
|
|||||||
laptop = true;
|
laptop = true;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
(mkIf (host == "phenom.dubronetwork.fr") {
|
(mkIf comp.isNomade{
|
||||||
|
r6d.profiles.isDubronetwork = true;
|
||||||
|
|
||||||
|
r6d.config-generator = {
|
||||||
|
laptop = true;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(mkIf comp.isPhenom {
|
||||||
r6d.profiles.isDubronetwork = true;
|
r6d.profiles.isDubronetwork = true;
|
||||||
r6d.profiles.isHome = true;
|
r6d.profiles.isHome = true;
|
||||||
r6d.profiles.isWorkstation = true;
|
r6d.profiles.isWorkstation = true;
|
||||||
|
|
||||||
|
r6d.config-generator.nix-serve-server = true;
|
||||||
|
r6d.config-generator.xmonad = true;
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# http://www.git-attitude.fr/2014/09/15/30-options-git-qui-gagnent-a-etre-connues/
|
||||||
[color]
|
[color]
|
||||||
diff = auto
|
diff = auto
|
||||||
branch = auto
|
branch = auto
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
ci = commit
|
ci = commit
|
||||||
co = checkout
|
co = checkout
|
||||||
ff = pull --ff-only
|
ff = pull --ff-only
|
||||||
|
oops = commit --amend --no-edit
|
||||||
# Show files ignored by git
|
# Show files ignored by git
|
||||||
ignored = ls-files -o -i --exclude-standard
|
ignored = ls-files -o -i --exclude-standard
|
||||||
ls = ls-files
|
ls = ls-files
|
||||||
|
|||||||
Reference in New Issue
Block a user