Compare commits
9 Commits
2016-07-09
...
2016-07-10
| Author | SHA1 | Date | |
|---|---|---|---|
| 30c9bd1b71 | |||
| b95c4509aa | |||
| e3d982a1fd | |||
| 021f6499f9 | |||
| 1416a12d22 | |||
| c9d1f4e67c | |||
| 2bb9511c1f | |||
| b4a72c5510 | |||
| 253403de89 |
@@ -1,9 +1,14 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
{
|
inherit (lib) mkIf mkMerge;
|
||||||
nix = pkgs.lib.mkIf config.r6d.config-generator.nix-serve-client {
|
profiles = config.r6d.profiles;
|
||||||
|
in {
|
||||||
|
nix = mkIf config.r6d.config-generator.nix-serve-client {
|
||||||
# Cache http pour le store
|
# Cache http pour le store
|
||||||
requireSignedBinaryCaches = false;
|
requireSignedBinaryCaches = false;
|
||||||
binaryCaches = [ "http://192.168.10.169:5000" ];
|
binaryCaches = [
|
||||||
|
(mkIf profiles.isDubronetwork "http://192.168.10.169:5000")
|
||||||
|
(mkIf profiles.isPrunetwork "http://192.168.1.20:5000")
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
# Cache http pour le store
|
# Cache http pour le store
|
||||||
|
|
||||||
services.nix-serve.enable = config.r6d.config-generator.nix-serve-server;
|
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];
|
networking.firewall.allowedTCPPorts = pkgs.lib.mkIf config.r6d.config-generator.nix-serve-server [ 5000 ];
|
||||||
}
|
}
|
||||||
5
base.nix
5
base.nix
@@ -9,10 +9,5 @@
|
|||||||
|
|
||||||
# inclusion conditionnelle
|
# inclusion conditionnelle
|
||||||
./config-generator.nix
|
./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
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,102 +1,53 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
# exemple utilisé pour commencer bird.nix
|
||||||
let
|
let
|
||||||
inherit (lib) mkEnableOption mkIf mkMerge mkOption singleton types;
|
inherit (lib) mkEnableOption mkIf mkMerge mkOption singleton types;
|
||||||
#inherit (pkgs) bird;
|
|
||||||
cfg = config.r6d.config-generator;
|
cfg = config.r6d.config-generator;
|
||||||
|
pfl = config.r6d.profiles;
|
||||||
# configFile = pkgs.writeText "bird.conf" ''
|
host = config.networking.hostName;
|
||||||
# ${cfg.config}
|
|
||||||
#'';
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./activation-manuelle/auto-upgrade.nix
|
||||||
|
./activation-manuelle/locate.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
|
||||||
|
r6d.profiles = {
|
||||||
|
# Domaine
|
||||||
|
isDubronetwork = mkEnableOption "Pour distinguer les machines dubronetwork.";
|
||||||
|
isPrunetwork = mkEnableOption "Pour distinguer les machines prunetwork.";
|
||||||
|
# Utilisation machine
|
||||||
|
isDesktop = mkEnableOption "Pour indiquer une machine avec interface graphique.";
|
||||||
|
isHome = mkEnableOption "Pour indiquer que la machine sert à la maison (divertissement & autre).";
|
||||||
|
isServer = mkEnableOption "Pour indiquer qu'il s'agit d'un serveur.";
|
||||||
|
isWorkstation = mkEnableOption "Pour indiquer que la machine sert à travailler.";
|
||||||
|
};
|
||||||
|
|
||||||
|
#* Utilisé dans les fichiers .nix
|
||||||
r6d.config-generator = {
|
r6d.config-generator = {
|
||||||
|
enable = mkEnableOption "Génération de la configuration d'une machine.";
|
||||||
enable = mkEnableOption "Generation de la configuration d'une machine";
|
auto-upgrade = mkEnableOption "Profil pour activer les mises à jour automatiques.";
|
||||||
|
docker = mkEnableOption "Profil pour l'utilisation de Docker.";
|
||||||
auto-upgrade = mkOption {
|
jeux = mkEnableOption "Profil pour les jeux vidéos.";
|
||||||
type = types.bool;
|
laptop = mkEnableOption "Profil pour les outils spécifiques aux ordinateurs portables..";
|
||||||
default = true;
|
locate = mkEnableOption "Profil pour activer la fonction locate.";
|
||||||
description = ''
|
nix-serve-client= mkEnableOption "Profil pour que la machine soit un serveur de cache nix.";
|
||||||
Profil pour activer les mises à jour automatiques.
|
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.";
|
||||||
|
|
||||||
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
|
###### implementation
|
||||||
# https://nixos.org/releases/nixos/14.12-small/nixos-14.12.374.61adf9e/manual/sec-writing-modules.html
|
# 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
|
# https://nixos.org/wiki/NixOS:extend_NixOS
|
||||||
@@ -107,47 +58,80 @@ in
|
|||||||
r6d.config-generator.enable = true;
|
r6d.config-generator.enable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Conditional stuff.
|
# 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") {
|
## Définition des profils génériques
|
||||||
r6d.config-generator = {
|
(mkIf pfl.isDesktop {
|
||||||
docker = true;
|
|
||||||
jeux = true;
|
|
||||||
laptop = true;
|
|
||||||
nix-serve-client = true;
|
|
||||||
};
|
|
||||||
})
|
})
|
||||||
(mkIf (config.networking.hostName == "monstre.dubronetwork.fr") {
|
(mkIf pfl.isHome {
|
||||||
r6d.config-generator = {
|
r6d.profiles.isDesktop = true;
|
||||||
nix-serve-server = true;
|
|
||||||
};
|
|
||||||
})
|
})
|
||||||
(mkIf (config.networking.hostName == "neo-nomade.dubronetwork.fr") {
|
(mkIf pfl.isServer {
|
||||||
r6d.config-generator = {
|
r6d.config-generator.nix-serve-server = true;
|
||||||
laptop = true;
|
|
||||||
nix-serve-client = true;
|
|
||||||
};
|
|
||||||
})
|
})
|
||||||
(mkIf (config.networking.hostName == "phenom.dubronetwork.fr") {
|
(mkIf pfl.isWorkstation {
|
||||||
|
r6d.profiles.isDesktop = true;
|
||||||
|
|
||||||
|
r6d.config-generator.docker = true;
|
||||||
|
})
|
||||||
|
(mkIf pfl.isDubronetwork {
|
||||||
|
r6d.config-generator.auto-upgrade = true;
|
||||||
|
r6d.config-generator.nix-serve-client = true;
|
||||||
|
})
|
||||||
|
(mkIf (pfl.isDubronetwork && pfl.isHome) {
|
||||||
|
r6d.config-generator.jeux = true;
|
||||||
|
})
|
||||||
|
(mkIf (pfl.isDubronetwork && pfl.isServer) {
|
||||||
|
r6d.config-generator.nix-serve-server = true;
|
||||||
|
})
|
||||||
|
(mkIf (pfl.isDubronetwork && pfl.isWorkstation) {
|
||||||
|
r6d.config-generator.nix-serve-server = true;
|
||||||
|
r6d.config-generator.virtualbox = true;
|
||||||
|
})
|
||||||
|
(mkIf pfl.isPrunetwork {
|
||||||
|
r6d.config-generator.auto-upgrade = true;
|
||||||
|
r6d.config-generator.nix-serve-client = true;
|
||||||
|
r6d.config-generator.swap = true;
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
## Affectation des profils aux machines
|
||||||
|
(mkIf (host == "radx.prunetwork.fr") {
|
||||||
|
r6d.profiles.isHome = true;
|
||||||
|
r6d.profiles.isPrunetwork = true;
|
||||||
|
r6d.profiles.isServer = true;
|
||||||
|
r6d.profiles.isWorkstation = true;
|
||||||
|
|
||||||
r6d.config-generator = {
|
r6d.config-generator = {
|
||||||
docker = true;
|
|
||||||
jeux = true;
|
|
||||||
nix-serve-client = true;
|
|
||||||
nix-serve-server = true;
|
|
||||||
virtualbox = true;
|
virtualbox = true;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
## Contenu des Profils
|
(mkIf (host == "latitude.dubronetwork.fr") {
|
||||||
# -> voir les sources des dépots base & desktop
|
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;
|
||||||
|
})
|
||||||
|
(mkIf (host == "neo-nomade.dubronetwork.fr") {
|
||||||
|
r6d.profiles.isDubronetwork = true;
|
||||||
|
r6d.profiles.isHome = true;
|
||||||
|
|
||||||
|
r6d.config-generator = {
|
||||||
|
laptop = true;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(mkIf (host == "phenom.dubronetwork.fr") {
|
||||||
|
r6d.profiles.isDubronetwork = true;
|
||||||
|
r6d.profiles.isHome = true;
|
||||||
|
r6d.profiles.isWorkstation = true;
|
||||||
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,28 +14,28 @@
|
|||||||
# $ nix-env -qaP | grep wget
|
# $ nix-env -qaP | grep wget
|
||||||
environment = {
|
environment = {
|
||||||
systemPackages = with pkgs; [
|
systemPackages = with pkgs; [
|
||||||
bind # utilisé pour les utilitaires comme dig
|
bind # utilisé pour les utilitaires comme dig
|
||||||
byobu
|
byobu # permet de se déconnecter d'un terminal sans l'aréter
|
||||||
exfat # Pour monter les FAT avec Fuse
|
exfat # Pour monter les FAT avec Fuse
|
||||||
git gitAndTools.gitSVN gitAndTools.tig
|
git gitAndTools.gitSVN gitAndTools.tig # outil de gestion de version
|
||||||
gnumake
|
gnumake # pour décrire les recettes de compilation
|
||||||
gnupg
|
gnupg # GPG
|
||||||
gpm # prise en charge de la souris en console
|
gpm # prise en charge de la souris en console
|
||||||
htop
|
htop # monitoring
|
||||||
ncdu
|
ncdu # outil pour voir l'espace utilisé
|
||||||
nmap
|
nmap # outil de scan de port réseau
|
||||||
mtr
|
mtr # outil de diagnostic réseau
|
||||||
p7zip
|
p7zip # compression de fichier
|
||||||
parted
|
parted # partitionnement de disque
|
||||||
pciutils
|
pciutils
|
||||||
python34Packages.glances
|
python34Packages.glances # monitoring
|
||||||
pwgen
|
pwgen # générateur de mot de passe
|
||||||
tmux
|
tmux # nécessaire pour byobu
|
||||||
tree
|
tree # affiche une arborescence de fichiers et dossiers
|
||||||
usbutils
|
usbutils
|
||||||
(import ./vim.nix)
|
(import ./vim.nix)
|
||||||
wget
|
wget # client HTTP console
|
||||||
which
|
which # pour connaitre le chemin d'un exécutable
|
||||||
];
|
];
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
byobu = "byobu-tmux";
|
byobu = "byobu-tmux";
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
boot.kernel.sysctl = {
|
boot.kernel.sysctl = {
|
||||||
"net.ipv6.conf.all.temp_prefered_lft" = 1800; # 30 min
|
"net.ipv6.conf.all.temp_prefered_lft" = 1800; # 30 min
|
||||||
"net.ipv6.conf.all.temp_valid_lft" = 3600; # 1 heure
|
"net.ipv6.conf.all.temp_valid_lft" = 43200; # 12 heures
|
||||||
"net.ipv6.conf.all.use_tempaddr" = 2; # activé
|
"net.ipv6.conf.all.use_tempaddr" = 2; # activé
|
||||||
|
|
||||||
"net.ipv6.conf.default.temp_prefered_lft" = 3600; # 1 heure
|
"net.ipv6.conf.default.temp_prefered_lft" = 3600; # 1 heure
|
||||||
|
|||||||
@@ -18,7 +18,9 @@
|
|||||||
# Enable CUPS to print documents.
|
# Enable CUPS to print documents.
|
||||||
services.printing = {
|
services.printing = {
|
||||||
enable = true;
|
enable = true;
|
||||||
drivers = [ pkgs.samsung-unified-linux-driver ];
|
drivers = [
|
||||||
|
pkgs.samsung-unified-linux-driver
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Monitoring
|
# Monitoring
|
||||||
|
|||||||
Reference in New Issue
Block a user