Compare commits
48 Commits
d7844c641c
...
2016-07-09
| Author | SHA1 | Date | |
|---|---|---|---|
| 2fa21f7f4d | |||
| 0bbddfbfa0 | |||
| 85ee98585b | |||
| 61d0c565ea | |||
| 0a8c503032 | |||
| 3d1feebee0 | |||
| d03f8cbfc2 | |||
| b277551d6a | |||
|
|
87a0a9d3de | ||
|
|
aae5d9a4cc | ||
| d4417b922a | |||
| c4a3515aa0 | |||
| 8d464837ec | |||
| e486a82be2 | |||
| eeae177744 | |||
| 22bd42f61f | |||
| 092b4a8b44 | |||
| 5c0c2fa2ec | |||
| d71f1b7f57 | |||
| cc1d6f5859 | |||
|
|
2cd5f1c03e | ||
|
|
48f45f76aa | ||
|
|
a228a0e52c | ||
|
|
2cf7a7a7ee | ||
|
|
54382e757c | ||
|
|
a91f81a650 | ||
|
|
c5eeaae443 | ||
|
|
71807d038a | ||
|
|
35b2dede57 | ||
| 2c4daa1766 | |||
| 6ae67f8e09 | |||
| d2b4afd9d4 | |||
|
|
c93cd28bb1 | ||
|
|
f5f92fcb07 | ||
|
|
4857ea1b56 | ||
| f7ac4acd54 | |||
| dccec5d306 | |||
| 58342eef57 | |||
|
|
521d362779 | ||
| e9cf5d5472 | |||
| 691b961d64 | |||
| 76e075cab4 | |||
|
|
51a3a75d74 | ||
|
|
6a53257409 | ||
| 78cb2f7976 | |||
|
|
ddc89e6a6e | ||
|
|
f8890aa003 | ||
| ec72d97c8f |
48
Makefile
Normal file
48
Makefile
Normal file
@@ -0,0 +1,48 @@
|
||||
all: rebuild-switch
|
||||
date
|
||||
|
||||
clean:
|
||||
nix-collect-garbage -d --delete-older-than 15d
|
||||
|
||||
clean-aggressive:
|
||||
nix-collect-garbage -d --delete-older-than 1d
|
||||
|
||||
clean-total:
|
||||
nix-collect-garbage -d
|
||||
|
||||
clean-log:
|
||||
journalctl --vacuum-size=1G
|
||||
|
||||
full-auto: submodules-update upgrade clean optimise
|
||||
|
||||
optimise:
|
||||
nix-store --optimise
|
||||
|
||||
push: submodules-push
|
||||
git push --all
|
||||
git push --tags
|
||||
|
||||
rebuild-switch:
|
||||
nixos-rebuild switch
|
||||
|
||||
store-repair:
|
||||
nix-store --verify --check-contents --repair
|
||||
|
||||
submodules-update:
|
||||
#git submodule update --remote
|
||||
git submodule foreach git co master
|
||||
git submodule foreach git ff
|
||||
|
||||
submodules-push:
|
||||
git submodule foreach git push --all
|
||||
git submodule foreach git push --tags
|
||||
|
||||
submodules-tag:
|
||||
git submodule foreach git tag -f "$$(date +%F)-$$(hostname -s)"
|
||||
|
||||
tag: submodules-tag
|
||||
git tag -f "$$(date +%F)-$$(hostname -s)"
|
||||
|
||||
upgrade:
|
||||
nixos-rebuild switch --upgrade
|
||||
|
||||
8
activation-manuelle/auto-upgrade.nix
Normal file
8
activation-manuelle/auto-upgrade.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Automatic update & automatic clean
|
||||
|
||||
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";
|
||||
};
|
||||
}
|
||||
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];
|
||||
}
|
||||
12
activation-manuelle/swap.nix
Normal file
12
activation-manuelle/swap.nix
Normal file
@@ -0,0 +1,12 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Gestion du swap
|
||||
|
||||
# https://en.wikipedia.org/wiki/Swappiness
|
||||
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;
|
||||
};
|
||||
}
|
||||
11
base.nix
11
base.nix
@@ -2,8 +2,17 @@
|
||||
|
||||
{
|
||||
imports = [
|
||||
./tools.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/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
|
||||
];
|
||||
}
|
||||
@@ -1,25 +1,38 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Nombre de process d'installation en parrallèle effectués par Nix
|
||||
nix.buildCores = 0;
|
||||
|
||||
# The NixOS release to be compatible with for stateful data such as databases.
|
||||
system.stateVersion = "16.03";
|
||||
|
||||
# On autorise les paquets non-libres
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# List packages installed in system profile. To search by name, run:
|
||||
# $ nix-env -qaP | grep wget
|
||||
environment = {
|
||||
systemPackages = with pkgs; [
|
||||
bind # utilisé pour les utilitaires comme dig
|
||||
byobu
|
||||
git gitAndTools.tig
|
||||
exfat # Pour monter les FAT avec Fuse
|
||||
git gitAndTools.gitSVN gitAndTools.tig
|
||||
gnumake
|
||||
gnupg
|
||||
gpm # prise en charge de la souris en console
|
||||
htop
|
||||
ncdu
|
||||
nmap
|
||||
mtr
|
||||
p7zip
|
||||
parted
|
||||
pciutils
|
||||
python34Packages.glances
|
||||
pwgen
|
||||
tmux
|
||||
tree
|
||||
usbutils
|
||||
(import ./vim.nix)
|
||||
wget
|
||||
which
|
||||
@@ -1,18 +1,29 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Définition des domaines utilisés lorsque un identifiant non-FQDN est donné (ping, nslookup)
|
||||
networking = {
|
||||
search = [
|
||||
"dubronetwork.fr"
|
||||
"prunetwork.fr"
|
||||
"teleragno.fr"
|
||||
"teleragno.net"
|
||||
];
|
||||
dnsExtensionMechanism = true;
|
||||
};
|
||||
|
||||
# Utilisation d'adresse IPv6 temporaire
|
||||
# https://blog.linitx.com/control-privacy-addressing-ipv6-linux/
|
||||
# http://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/x1092.html
|
||||
|
||||
## https://blog.linitx.com/control-privacy-addressing-ipv6-linux/
|
||||
## http://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/x1092.html
|
||||
|
||||
boot.kernel.sysctl = {
|
||||
"net.ipv6.conf.all.temp_prefered_lft" = 3600; # 1 heure
|
||||
"net.ipv6.conf.all.temp_valid_lft" = 86400; # 1 jour
|
||||
"net.ipv6.conf.all.temp_prefered_lft" = 1800; # 30 min
|
||||
"net.ipv6.conf.all.temp_valid_lft" = 3600; # 1 heure
|
||||
"net.ipv6.conf.all.use_tempaddr" = 2; # activé
|
||||
|
||||
"net.ipv6.conf.default.temp_prefered_lft" = 3600; # 1 heure
|
||||
"net.ipv6.conf.default.temp_valid_lft" = 86400; # 1 jour
|
||||
"net.ipv6.conf.default.temp_valid_lft" = 3600; # 1 heure
|
||||
"net.ipv6.conf.default.use_tempaddr" = 2; # activé
|
||||
};
|
||||
}
|
||||
|
||||
31
services.nix
Normal file
31
services.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Sécurité & Acces distant
|
||||
|
||||
## Augmentation de l'entropie du système par un générateur de nombres aléatoires
|
||||
## cat /proc/sys/kernel/random/entropy_avail
|
||||
services.haveged = {
|
||||
enable = true;
|
||||
refill_threshold = 2048;
|
||||
};
|
||||
|
||||
## OpenSSH daemon
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Enable CUPS to print documents.
|
||||
services.printing = {
|
||||
enable = true;
|
||||
drivers = [ pkgs.samsung-unified-linux-driver ];
|
||||
};
|
||||
|
||||
# Monitoring
|
||||
|
||||
## Noeud de supervision munin = pas de stockage des données locales
|
||||
|
||||
services.munin-node = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user