Compare commits

..

20 Commits

Author SHA1 Message Date
cc851a7946 add assertion 2017-05-31 15:46:27 +02:00
aa22c6337d migrated into profile 2017-05-31 15:43:42 +02:00
acacc94903 add development packages to workstation profile 2017-05-31 15:41:12 +02:00
1f480bbbff add option to identify Workstations 2017-05-31 14:45:39 +02:00
Yves Dubromelle
ac91ce4492 regroupement des options éparses en configurationOptions et renommage 2017-05-31 00:23:10 +02:00
Yves Dubromelle
c43adc80cb utilisation des profils pour modifier les flags :) 2017-05-30 23:21:33 +02:00
Yves Dubromelle
745d2cd171 on peut se passer de passer lib en paramètre 2017-05-25 23:30:50 +02:00
Yves Dubromelle
259a1a0aa6 cible make pour juste builder NixOS sans appliquer 2017-05-25 02:18:07 +02:00
Yves Dubromelle
854eed9227 ébauche de fonction pour générer un profil 2017-05-25 02:17:42 +02:00
8ee09217cb une machine hydra-builder doit faire du garbage-collection régulièrement 2017-05-22 10:42:16 +02:00
b15672c3ad ménage config generator 2017-05-21 13:58:09 +02:00
ab1d364327 ajout option munin 2017-05-20 22:43:52 +02:00
67eadfab97 ces anciens profils ont été convertis en assertions 2017-05-19 17:18:20 +02:00
ff733c5d08 migration monstre 2017-05-19 13:02:31 +02:00
d3f1f2121e ajustement readme 2017-05-19 13:02:31 +02:00
Yves Dubromelle
cdd75e063d assertion DNS 2017-05-19 12:58:39 +02:00
a816a81b9e migration machines 2017-05-19 12:37:39 +02:00
aa6ae3cc8d ajout config yubike 2017-05-15 22:53:29 +02:00
419a1cbf53 fix: spacefm crashes https://github.com/IgnorantGuru/spacefm/issues/671 2017-05-15 20:34:35 +02:00
b03d4acfe2 add assertions on base 2017-05-13 17:13:23 +02:00
76 changed files with 248 additions and 258 deletions

View File

@@ -23,6 +23,9 @@ full-auto: submodules-update upgrade clean optimise
optimise:
$(TIME) nix-store --optimise
rebuild-build:
$(TIME) time nixos-rebuild build --fallback --show-trace
rebuild-switch:
$(TIME) time nixos-rebuild switch --fallback --show-trace

View File

@@ -18,7 +18,7 @@ Actuellement, les scripts contiennent un peu de configuration spécifique pour l
* mettre à jour les dépôts avec les dernières versions, `make submodules-update`
* tester la configuration : `nixos-rebuild build`
* corriger et ajouter les éléments manquant (notamment dans `private/annuaire.nix` )
* vérifier que `configuration.nix` ne contient pas `services.xserver.enable = true;`
* vérifier que `configuration.nix` contient `services.xserver.enable = true;` pour les machines avec interface graphique
* lorsque tout semble bon, vérifier :
* qu'il y a toujours des utilisateurs dans la configuration
* que le moyen d'accéder à la machine n'a pas été supprimé (surtout les machines distantes)

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.graphical {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf currentMachine.profiles.isDesktopEnvironment {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (flags.officeSuite && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (flags.conception-assistee && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (flags.cartographie && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
# TODO: ménage
mkIf (flags.internetSuite && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (true && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
#inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
{

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (flags.developpement-elm && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (flags.developpement-haskell && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (flags.developpement-java && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (flags.jetbrains-licensed && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (flags.developpement-rust && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (flags.developpement && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (flags.edition-musique && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (flags.edition-photo && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (flags.edition-video && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (flags.jeux && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
# TODO ranger le spécifique pulseaudio

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (true && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf (flags.securitySuite && flags.graphical) {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf true {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf true {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.officeSuite {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.conception-assistee {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.cartographie {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
# TODO: ménage
mkIf flags.internetSuite {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf true {
@@ -32,6 +32,7 @@ mkIf true {
#python34Packages.glances # monitoring
pwgen # générateur de mot de passe
rtorrent # TODO outil de téléchargement de torrent & magnet
shared_mime_info # MIME info
tmux # nécessaire pour byobu
tree # affiche une arborescence de fichiers et dossiers
usbutils

View File

@@ -4,7 +4,7 @@ let
#inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
{

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.developpement-elm {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.developpement-haskell {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.developpement-java {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.jetbrains-licensed {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.developpement-rust {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.developpement {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.edition-musique {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.edition-photo {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.edition-video {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.jeux {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.multimediaSuite {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf true {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.securitySuite {

View File

@@ -8,7 +8,7 @@ let
host = config.networking.hostName;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
{
@@ -21,15 +21,12 @@ in
options = {
#* Utilisé pour avoir des raccourcis de machine
r6d.computers = {
isHydra = mkEnableOption "Identification du nom de machine.";
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.";
isOcean = mkEnableOption "Identification du nom de machine.";
isPedro = mkEnableOption "Identification du nom de machine.";
isPhenom = mkEnableOption "Identification du nom de machine.";
isRadx = mkEnableOption "Identification du nom de machine.";
isRollo = mkEnableOption "Identification du nom de machine.";
};
};
@@ -40,16 +37,6 @@ in
config = mkMerge
[
## Définition des profils génériques
(mkIf pfl.isDesktopEnvironment {
r6d.config-generator = {
awesome = true;
internetSuite = true;
multimediaSuite = true;
officeSuite = true;
pulseaudio = true;
securitySuite = true;
};
})
(mkIf (pfl.isServer && !comp.isMonstre) {
r6d.config-generator = {
#database_postgres = true;
@@ -68,140 +55,8 @@ in
dns_resolveur = true;
};
})
(mkIf pfl.isWorkstation {
r6d.profiles.isDesktopEnvironment = true;
r6d.config-generator = {
docker = true;
graphical = true;
};
})
## Profils liés à Dubronetwork
(mkIf pfl.isDubronetwork {
r6d.config-generator = {
auto-upgrade = true;
locate = true;
print = true;
};
})
(mkIf (pfl.isDubronetwork && pfl.isWorkstation) {
r6d.config-generator = {
cartographie = true;
conception-assistee = true;
docker = true;
developpement = true;
developpement-elm = true;
developpement-haskell = true;
developpement-java = true;
developpement-rust = true;
edition-musique = true;
edition-photo = true;
edition-video = true;
scanner = true;
virtualbox = true;
xmonad = true;
};
})
## Profils liés à Prunetwork
(mkIf pfl.isPrunetwork {
r6d.config-generator = {
auto-upgrade = true;
docker = true;
locate = true;
fail2ban = true;
smokeping = true;
swap = true;
};
})
(mkIf (pfl.isPrunetwork && pfl.isWorkstation) {
r6d.config-generator = {
cartographie = true;
conception-assistee = true;
docker = true;
developpement = true;
#developpement-elm = true;
developpement-haskell = true;
developpement-java = true;
developpement-rust = true;
edition-musique = true;
edition-photo = true;
edition-video = true;
hydra-core = false; # DO NOT ENABLE ON WORKSTATION, YOU CAN CRASH YOUR SYSTEM
print = true;
scanner = true;
#virtualbox = true;
#xmonad = true;
};
})
## Affectation des profils aux machines
(mkIf comp.isHydra {
networking.hostName = "hydra.prunetwork.fr"; # Define your hostname.
r6d.profiles = {
isPrunetwork = true;
isServer = true;
};
r6d.config-generator = {
docker = true;
hydra-builder = true;
hydra-core = true;
nix-serve-server = true;
tincAddress = "192.168.12.9/24";
tincExtraConfig = ''
ConnectTo = rollo_dubronetwork_fr
ConnectTo = ocean_prunetwork_fr
'';
};
})
(mkIf comp.isOcean {
networking.hostName = "ocean.prunetwork.fr"; # Define your hostname.
r6d.profiles = {
isPrunetwork = true;
isServer = true;
};
r6d.config-generator = {
docker = true;
hydra-builder = true;
radicale = true;
nix-serve-client = true;
nix-serve-server = true;
tincAddress = "192.168.12.6/24";
tincExtraConfig = ''
ConnectTo = hydra_prunetwork_fr
ConnectTo = rollo_dubronetwork_fr
'';
};
})
(mkIf comp.isRadx {
networking.hostName = "radx.prunetwork.fr"; # Define your hostname.
r6d.profiles = {
isPrunetwork = true;
isWorkstation = true;
};
r6d.config-generator = {
database_postgres = true;
elasticsearch = true;
#hydra-core = false; # DO NOT ENABLE ON WORKSTATION
kibana = true;
nix-serve-client = true;
nix-serve-server = true;
#rabbitmq = true;
tincAddress = "192.168.12.3/24";
tincExtraConfig = ''
ConnectTo = monstre_dubronetwork_fr
ConnectTo = rollo_dubronetwork_fr
ConnectTo = hydra_prunetwork_fr
ConnectTo = ocean_prunetwork_fr
'';
virtualbox = true;
};
})
(mkIf comp.isLatitude {
networking.hostName = "latitude.dubronetwork.fr"; # Define your hostname.
@@ -224,27 +79,7 @@ in
'';
};
})
(mkIf comp.isMonstre {
networking.hostName = "monstre.dubronetwork.fr"; # Define your hostname.
r6d.profiles = {
isDubronetwork = true;
isServer = true;
};
r6d.config-generator = {
fail2ban = true;
murmur = true;
nix-serve-client = true;
nix-serve-server = true;
nixStoreProxyCache = true;
tincAddress = "192.168.12.4/24";
tincExtraConfig = ''
ConnectTo = rollo_dubronetwork_fr
ConnectTo = hydra_prunetwork_fr
ConnectTo = ocean_prunetwork_fr
'';
};
})
(mkIf comp.isNeoNomade{
networking.hostName = "neo-nomade.dubronetwork.fr"; # Define your hostname.
r6d.profiles = {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.auto-upgrade {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
# TODO: rc.lua par défaut (système)

View File

@@ -4,7 +4,7 @@ let
#inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
{

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
# TODO: ménage

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.laptop {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf true {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf true {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf true {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.swap {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf false {

50
lib.nix Normal file
View File

@@ -0,0 +1,50 @@
let
lib = with import <nixpkgs> {}; pkgs.lib;
profiles = {
isDesktopEnvironment = {
awesome = true;
internetSuite = true;
graphical = true;
multimediaSuite = true;
officeSuite = true;
pulseaudio = true;
securitySuite = true;
};
isWorkstation = {
docker = true;
developpement = true;
developpement-elm = true;
developpement-haskell = true;
developpement-java = true;
developpement-rust = true;
};
#isServer = {
#};
};
in
with lib; rec{
# Apply the profiles (pre-defined + custom) to the whole directory
applyProfilesToDirectory = customProfiles: directory:
lib.mapAttrs (applyProfilesToMachine customProfiles) directory;
# Apply the profiles (pre-defined + custom) to a machine
applyProfilesToMachine = customProfiles: machineName: machineOptions:
{ configurationFlags = lib.recursiveUpdate (generateFlagsSet customProfiles machineOptions.profiles) machineOptions.configurationFlags;
configurationOptions = machineOptions.configurationOptions;
profiles = machineOptions.profiles;
};
# Generate a set of configuration flags based on profiles
generateFlagsSet = customProfiles: machineProfiles:
let
allProfiles = recursiveUpdate profiles customProfiles;
conditionalFlags = name: value:
if machineProfiles.${name}
then value
else {};
in
foldr (a: b: a // b) {} (mapAttrsToList conditionalFlags allProfiles);
}

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf true {

View File

@@ -6,7 +6,7 @@ let
machineOptions = types.submodule {
options = {
configuration-flags = {
configurationFlags = {
#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.";
@@ -38,6 +38,7 @@ let
locate = mkEnableOption "Profil pour activer la fonction locate.";
mailboxes = mkEnableOption "Profil pour stocker les mails dans des boîtes aux lettres.";
multimediaSuite = mkEnableOption "Profil pour la suite multimédia.";
munin = mkEnableOption "Profil pour activer la supervision par Munin";
murmur = mkEnableOption "Profil pour activer un serveur Mumble (murmur)";
nix-serve-server = mkEnableOption "Profil pour que la machine soit un serveur de cache nix.";
nixStoreProxyCache = mkEnableOption "Profil pour activer le proxy cahce nginx pour le nix store";
@@ -56,15 +57,7 @@ let
znc = mkEnableOption "Profil pour activer le relais IRC ZNC.";
};
profiles = {
# Domaine
isDubronetwork = mkEnableOption "Pour distinguer les machines dubronetwork.";
isPrunetwork = mkEnableOption "Pour distinguer les machines prunetwork.";
# Utilisation machine
isDesktopEnvironment = mkEnableOption "Pour indiquer une machine avec interface graphique.";
isServer = mkEnableOption "Pour indiquer qu'il s'agit d'un serveur.";
isWorkstation = mkEnableOption "Pour indiquer que la machine sert à travailler.";
};
configurationOptions = {
ipAddress = mkOption {
description = "Adresse IP";
@@ -127,7 +120,24 @@ let
};
};
};
profiles = {
# Domaine
isDubronetwork = mkEnableOption "Pour distinguer les machines dubronetwork.";
isDubronetworkWorkstation = mkEnableOption "Pour distinguer les machines dubronetwork avec Workstation.";
isPrunetwork = mkEnableOption "Pour distinguer les machines prunetwork.";
isPrunetworkWorkstation = mkEnableOption "Pour distinguer les machines prunetwork avec Workstation.";
# Utilisation machine
isDesktopEnvironment = mkEnableOption "Pour indiquer une machine avec interface graphique.";
isServer = mkEnableOption "Pour indiquer qu'il s'agit d'un serveur.";
isWorkstation = mkEnableOption "Pour indiquer que la machine sert à travailler.";
};
};
};
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configurationFlags;
in
{
@@ -139,4 +149,43 @@ in
'';
};
};
config = {
/**
prototype : (expression A ) && tests || !(expression A) -> réalise le test si A est satisfait, et continue sinon = pas de politique
*/
assertions = [
{
assertion = (currentMachine.profiles.isWorkstation && (currentMachine.configurationFlags.graphical == true))
|| (!currentMachine.profiles.isWorkstation);
message = "A workstation requires a graphical environement.";
}
{
assertion = (currentMachine.profiles.isDesktopEnvironment && (currentMachine.configurationFlags.graphical == true))
|| (!currentMachine.profiles.isDesktopEnvironment);
message = "A desktop station requires a graphical environement.";
}
{
assertion = (currentMachine.profiles.isDesktopEnvironment && (config.services.xserver.enable == true))
|| (!currentMachine.profiles.isDesktopEnvironment);
message = "You need to enable xserver manually.";
}
{
assertion = (currentMachine.profiles.isServer && (currentMachine.profiles.isDesktopEnvironment == false))
|| (!currentMachine.profiles.isServer);
message = "A graphical environment is not required for a server.";
}
{
/* At least one (authorité or resolveur) */
assertion = flags.dns_autorite || flags.dns_resolveur;
message = "DNS service is disabled. You must enable a dns recursor or autoritative.";
}
{
/* authorité xor resolveur */
assertion = (flags.dns_autorite && ! flags.dns_resolveur)
|| (!flags.dns_autorite && flags.dns_resolveur);
message = "Both authoritative and recursor DNS services can't be live simultaneously. Choose only one!";
}
];
};
}

View File

@@ -4,7 +4,7 @@ let
#inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
{
@@ -13,6 +13,7 @@ in
./haveged.nix
./monitoring-munin.nix
./ssh.nix
./yubikey.nix
# commandées par config-generator
## option de configuration spécifique

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.docker {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.elasticsearch {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf true {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.developpement-haskell {

View File

@@ -4,29 +4,39 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
# TODO: ménage
mkIf flags.hydra-builder {
# Paquets
environment.systemPackages = with pkgs; [
qemu
kvm
qemu
virtualbox
];
# Services
## Services de virtualisation utilisé pour les tests hydra
virtualisation.docker.enable = true;
virtualisation.libvirtd.enable = true;
virtualisation.libvirtd.enableKVM = true;
#virtualisation.virtualbox.guest.enable = true;
virtualisation.virtualbox.host.enable = true;
virtualisation.virtualbox.host.headless = true;
virtualisation = {
docker.enable = true;
libvirtd = {
enable = true;
enableKVM = true;
};
virtualbox = {
#guest.enable = true;
host.enable = true;
host.headless = true;
};
};
## Ménage automatique tous les jours
nix.gc.automatic = true;
## Ménage automatique tous les jours - Frequent garbage collection is a good idea for build machines.
nix.gc = {
automatic = true;
dates = "*:0/30";
};
# users.users."hydrabld" = {
# description = "Execution des jobs hydra";

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
#### https://github.com/NixOS/hydra/issues/413

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.kibana {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.locate {

View File

@@ -4,12 +4,11 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
# TODO: ajouter option
# TODO: changer adresse mail
mkIf true {
mkIf flags.munin {
# Paquets
environment.systemPackages = with pkgs; [

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.print {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.pulseaudio {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.scanner {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf true {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.virtualbox {

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
/**

View File

@@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configuration-flags;
flags = currentMachine.configurationFlags;
in
mkIf flags.xmonad {

42
services/yubikey.nix Normal file
View File

@@ -0,0 +1,42 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configurationFlags;
in
mkIf true {
# Services
# https://github.com/NixOS/nixpkgs/issues/15960
services = {
pcscd.enable = true;
udev.packages = with pkgs; [
libu2f-host
yubikey-personalization
];
xserver.displayManager.sessionCommands = ''
# https://github.com/NixOS/nixpkgs/commit/5391882ebd781149e213e8817fba6ac3c503740c
gpg-connect-agent /bye
GPG_TTY=$(tty)
export GPG_TTY
'';
};
users.extraGroups.yubikey = {};
environment.systemPackages = with pkgs; [
gnupg opensc pcsctools libu2f-host yubikey-personalization
];
security.pam.enableU2F = true;
/*users.extraUsers.joko = {
isNormalUser = true;
extraGroups = [ "wheel" "input" "audio" "video" ];
};*/
}