Compare commits

..

41 Commits

Author SHA1 Message Date
Yves Dubromelle
7681f7774e nixos: 19.03 -> 19.09 2019-11-19 22:38:25 +01:00
Yves Dubromelle
fe0ea31e30 les variantes de git se catapultent -> git full par défaut 2019-08-21 00:11:09 +02:00
f7de6a69bd oops 2019-07-09 19:53:00 +02:00
9151b4dfc5 radio : ménage dans les paquets 2019-07-09 02:21:18 +02:00
Yves Dubromelle
209b1b3e47 outils dans le system tray pour : batterie, volume, bluetooth 2019-06-23 19:13:23 +02:00
Yves Dubromelle
8355abcbfc le bluetooth peut être éteint par défaut (ça consomme) 2019-06-23 19:12:47 +02:00
Yves Dubromelle
9150a37969 gestion de l'énergie : TLP fait bien le job 2019-06-19 09:51:46 +02:00
Yves Dubromelle
59d243bb9d wireshark: package -> option (gestion fine des droits) 2019-06-10 17:22:56 +02:00
Yves Dubromelle
c7a1a433ef nm-applet: package -> option (activation automatique) 2019-06-10 17:21:00 +02:00
Yves Dubromelle
da750b9c33 java 11 est la LTS officielle, autant l'utiliser 2019-06-10 12:53:08 +02:00
Yves Dubromelle
0ff5f2934e synaptics est dépcrécié -> libinput 2019-06-10 12:53:08 +02:00
Yves Dubromelle
f0d5881c80 ajout de ant et gradle en plus de maven, pas de jaloux :) 2019-06-10 12:53:08 +02:00
Yves Dubromelle
16b0a5b617 nixpkgs a une nouvelle option pour gérer java + JAVA_HOME 2019-06-10 12:53:08 +02:00
de02b42953 munin : ajout de monitoring pout chrony 2019-06-06 23:32:51 +02:00
25275ec0dd make : ajustement statistiques ntp 2019-06-01 19:56:37 +02:00
19258654cf nixos-manual : ajustement clef de config suite migration NixOS 19.03 2019-05-26 13:07:20 +02:00
7a7bcc99f2 EXP désactivation de darcs 2019-05-18 12:15:09 +02:00
dddc3e79e0 ajout font awesome 2019-05-18 12:14:23 +02:00
1e8b78d720 make: ajout cible 'list-installed-packages' 2019-05-18 12:14:23 +02:00
366eebee8a radio : compilation ok gnu-radio 2019-05-18 12:14:23 +02:00
5ecdc764ac make: commande lancer awesome en mode de test 2019-05-18 12:14:23 +02:00
Yves Dubromelle
a5e03f769b /!\ migration à nixos 19.03 (18.03 plus mis à jour) 2019-05-09 12:30:21 +02:00
Yves Dubromelle
c642afb7e6 formater de code haskell en vogue 2019-05-09 08:24:26 +02:00
Yves Dubromelle
1127daa925 désactivation de paquets haskell qui ne build plus 2019-05-09 08:23:44 +02:00
Jean-Pierre PRUNARET
328eabc735 ssh: augmentation du nombre de connexions simultanées en mode proxy 2018-12-31 14:17:45 +01:00
Jean-Pierre PRUNARET
f2247b6e3e Revert "l'attribut de génération des pages de man a changé de nom (-> documentation.man.enable)"
This reverts commit 0c47de1cb1.
2018-05-05 22:15:06 +02:00
Jean-Pierre PRUNARET
0073763f32 Revert "munin : blocage du module car refuse de s'installer" -> fonctionne avec nixos stable
This reverts commit 8dcdea29c1.
2018-05-05 22:11:04 +02:00
e2ba892109 /!\ FORCE NIXOS 18.03 pour corriger une infinite recursion sur nix 2018-05-05 22:10:48 +02:00
0c47de1cb1 l'attribut de génération des pages de man a changé de nom (-> documentation.man.enable) 2018-04-18 07:34:36 +02:00
8dcdea29c1 munin : blocage du module car refuse de s'installer 2018-04-07 10:41:04 +02:00
cffcd9bd3e makefile: utilisation de variable globale 2018-03-04 18:29:42 +01:00
3f80d6be6e scanner: activation du service + driver HP 2018-03-04 13:13:13 +01:00
e94b16fce7 ahout de "." dans les descriptions 2018-03-02 08:02:41 +01:00
3f038be64a template : ajout d'un exemple d'assertion 2018-03-02 07:57:10 +01:00
76fce51cf0 munin: config notifications 2018-02-16 00:32:52 +01:00
264a782227 ajout options de config pour quagga 2018-01-18 22:56:20 +01:00
e56040b333 u2f: import configuration pour activer le support des clefs FIDO / u2f
Notes :
- import de conf active sur radx
- fonctionne avec Chromium & Github
- ne fonctionne pas avec Firefox & Github
2018-01-17 21:08:25 +01:00
bb08ab258f ssh: ordre de paramétrage du client SSH 2018-01-05 21:27:12 +01:00
ab183dbc00 ajout d'une option dans tinc pour stocker le nom DNS de la machine 2018-01-05 21:11:31 +01:00
62164179ed profil developpement: ajout des autotools 2018-01-05 21:10:27 +01:00
b04e9502f0 make : ajout cible show-time pour avoir les stats de chrony (service ntp) 2018-01-05 21:09:49 +01:00
30 changed files with 885 additions and 47 deletions

View File

@@ -1,6 +1,10 @@
GSF=git submodule foreach
TIME=time
CHRONY_STATUS=chronyc tracking
CHRONY_STATS=chronyc sources -v
CHRONY_STATS_SOURCES=chronyc sourcestats
all: rebuild-switch
date
##--------- Commandes spécifiques pour NixOS
@@ -21,10 +25,17 @@ clean-log:
full-auto: submodules-update upgrade clean optimise
@date
list-installed-packages:
@# source : https://functor.tokyo/blog/2018-02-20-show-packages-installed-on-nixos
@# https://www.domenkozar.com/2014/01/02/getting-started-with-nix-package-manager/
@#nixos-option environment.systemPackages
nixos-option environment.systemPackages | head -2 | tail -1 | sed -e 's/ /\n/g' | cut -d- -f2- | sort | uniq| sed -e 's/"$$//'
optimise:
$(TIME) nix-store --optimise
$(TIME) nix optimise-store
rebuild-build:
nix-channel --add https://nixos.org/channels/nixos-19.09 nixos
$(TIME) time nixos-rebuild build --fallback --show-trace
rebuild-switch:
@@ -39,10 +50,15 @@ show-diff-with-current:
show-roots:
nix-store --gc --print-roots
show-time:
-@$(CHRONY_STATUS) && $(CHRONY_STATS)
-@watch -d -n 2 "$(CHRONY_STATUS) && echo "-- Statistiques générales :" && $(CHRONY_STATS) && echo "-- Statistiques sur les sources :" && $(CHRONY_STATS_SOURCES) && echo "-- Statistiques sur les clients :" && chronyc clients"
store-repair:
$(TIME) nix-store --verify --check-contents --repair
upgrade:
nix-channel --add https://nixos.org/channels/nixos-19.09 nixos
$(TIME) nixos-rebuild switch --upgrade --fallback --show-trace
##--------- Commandes spécifiques pour NixOS -- Opérations non courantes
@@ -97,3 +113,6 @@ tmpfs-umount:
tmpfs-destroy: tmpfs-umount
rmdir /mnt/tmpfs
##- Test awesome
test-awesome:
Xephyr :5 & sleep 1; DISPLAY=:5 awesome

View File

@@ -39,6 +39,7 @@ mkIf currentMachine.profiles.isDesktopEnvironment {
fira # police créée pour Firefox
fira-code # idem fira-mono + ligatures pour la programmation
fira-mono # dérivée de fira en monospace
font-awesome_5 # Jeux de police, utilisé avec Latex
hack-font # police monospace créée explicitement pour coder
hasklig # police dérivée de source-code-pro mais avec des ligatures
];

View File

@@ -21,7 +21,7 @@ environment.systemPackages = with pkgs; [
clawsMail
hexchat
quasselClient
mumble
#mumble
pidgin
thunderbird

View File

@@ -13,6 +13,6 @@ mkIf (flags.developpement-haskell && flags.graphical) {
environment.systemPackages = with pkgs; [
] ++ (with pkgs.haskellPackages; [
# Haskell lib
threadscope # visualisation des threads (<bidule>.eventlog)
#threadscope # visualisation des threads (<bidule>.eventlog)
]);
}

View File

@@ -21,7 +21,6 @@ mkIf (flags.developpement && flags.graphical) {
# Gestion des sources
#gitg # interface pour utiliser git (historique, commit)
gitstats # génère un site web statique avec des statistiques
gitAndTools.gitFull # pour gitk
git-cola # interface pour utiliser git (historique, commit)
## Visualisation & outils de diff

View File

@@ -9,9 +9,13 @@ in
mkIf (true && flags.graphical) {
# Diagnostic réseau Wireshark (droits fins par le groupe wireshark)
programs.wireshark = {
enable = true;
package = pkgs.wireshark;
};
# Paquets
environment.systemPackages = with pkgs; [
## Diagnostic
wireshark
];
}

View File

@@ -12,15 +12,10 @@ mkIf (flags.radio && flags.graphical) {
# Paquets
environment.systemPackages = with pkgs; [
## GUI
gqrx # GUI
#gnuradio # Software Defined Radio (SDR) software
gnuradio-with-packages
gqrx # GUI
gnuradio-with-packages # Software Defined Radio (SDR) software
## A Trier
#
#gnuradio-osmosdr # Gnuradio block for OsmoSDR and rtl-sdr
inspectrum # Tool for analysing captured signals from sdr receivers
kalibrate-rtl # Calculate local oscillator frequency offset in RTL-SDR devices
#inspectrum # Tool for analysing captured signals from sdr receivers
];
}

View File

@@ -12,7 +12,7 @@ mkIf true {
# Paquets
environment.systemPackages = with pkgs; [
byobu # permet de se déconnecter d'un terminal sans l'arréter
git gitAndTools.tig gti # outil de gestion de version
gitAndTools.gitFull gitAndTools.tig gti # outil de gestion de version
gnumake # pour décrire les recettes de compilation
gnupg # GPG
htop # monitoring

View File

@@ -19,8 +19,9 @@ mkIf flags.developpement-haskell {
] ++ (with pkgs.haskellPackages; [
# Haskell lib
autoproc # ? procmail
darcs # gestionnaire de version éponyme
ghc-mod # outil d'analyse de code haskell utilisé par IDE
#brittany # formatteur de code
#darcs # gestionnaire de version éponyme
#ghc-mod # outil d'analyse de code haskell utilisé par IDE
hindent # indentation code
hlint # qualite de code, analyse statique de code + astuces & bonnes pratiques
#postgrest # mapper HTTP <-> PostgreSQL
@@ -29,7 +30,7 @@ mkIf flags.developpement-haskell {
turtle # genre shell-scripting
# Application perso
hahp
#hahp
pandoc-filter-graphviz # filtre pour utiliser graphviz à partir de pandoc
]);
}

View File

@@ -9,13 +9,17 @@ in
mkIf flags.developpement-java {
# Installe le paquet + JAVA_HOME
programs.java = {
enable = true;
package = pkgs.jdk11;
};
# Paquets
environment.systemPackages = with pkgs; [
# Java
# Systèmes de build autour de java
ant
maven
openjdk
gradle
];
environment.variables = {
JAVA_HOME = "${pkgs.openjdk}";
};
}

View File

@@ -11,6 +11,11 @@ mkIf flags.developpement {
# Paquets
environment.systemPackages = with pkgs; [
# Build / outil de construction
autobuild
autoconf
automake
# Base de données
pg_top # monitoring de PostgreSQL
sqlite # le moteur de base de données
@@ -20,7 +25,6 @@ mkIf flags.developpement {
# Gestion des sources
cloc # outil pour compter les lignes de code source
git gitAndTools.gitSVN # git et git-svn
mercurial
subversion

View File

@@ -15,6 +15,7 @@ in
./localisation.nix
./network.nix
#./network-ipv6.nix
./u2f.nix
./udev.nix
# commandées par config-generator

View File

@@ -12,7 +12,7 @@ in
nix.buildCores = 0;
# The NixOS release to be compatible with for stateful data such as databases.
system.stateVersion = "18.03";
system.stateVersion = "19.09";
# copies the NixOS configuration file (usually /etc/nixos/configuration.nix) and links it from the resulting system (getting to /run/current-system/configuration.nix)
system.copySystemConfiguration = true;
@@ -27,7 +27,8 @@ in
boot.cleanTmpDir = true;
# Activation des pages de manuel
programs.man.enable = true;
documentation.man.enable = true;
# Paquets
environment = {
@@ -60,7 +61,7 @@ in
# Host keys the client accepts - order here is honored by OpenSSH
HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,ssh-rsa,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp256,ecdh-sha2-nistp384,diffie-hellman-group-exchange-sha256
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
'';

View File

@@ -12,22 +12,28 @@ mkIf flags.laptop {
# Gestion spécifique pour PC portable
## Gestion de l'énergie
powerManagement.cpuFreqGovernor = "powersave";
services.tlp.enable = true;
## Activation d'un gestionnaire de réseau
networking.networkmanager.enable = true;
hardware.bluetooth.enable = true;
hardware.bluetooth = {
enable = true;
powerOnBoot = false;
};
# Gestion graphique du réseau dans la barre système
programs.nm-applet.enable = true;
# Paquets
environment.systemPackages = with pkgs; [
networkmanagerapplet # gestionnaire réseau graphique + console (nm-applet + nmtui)
wirelesstools # fournis iwconfig
blueman # outils bluetooth (manager, system tray)
cbatticon # status de la batterie dans le system tray
];
# Services
services.xserver.synaptics = {
services.xserver.libinput = {
enable = true;
twoFingerScroll = true;
};
}

41
configuration/u2f.nix Normal file
View File

@@ -0,0 +1,41 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.hostName}";
flags = currentMachine.configurationFlags;
in
mkIf true {
# Ajout du support des yobikey & hyperfido
## source des valeurs udev : https://github.com/Yubico/libu2f-host/blob/master/70-u2f.rules
## source car udev sur nixos semble ancien : https://raw.githubusercontent.com/Yubico/libu2f-host/master/70-old-u2f.rules
services.udev.extraRules = ''
# this udev file should be used with udev older than 188
ACTION!="add|change", GOTO="u2f_end"
# Yubico YubiKey
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0113|0114|0115|0116|0120|0402|0403|0406|0407|0410", GROUP="plugdev", MODE="0660"
# Happlink (formerly Plug-Up) Security KEY
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="2581", ATTRS{idProduct}=="f1d0", GROUP="plugdev", MODE="0660"
# Neowave Keydo and Keydo AES
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1e0d", ATTRS{idProduct}=="f1d0|f1ae", GROUP="plugdev", MODE="0660"
# HyperSecu HyperFIDO
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="096e", ATTRS{idProduct}=="0880", GROUP="plugdev", MODE="0660"
LABEL="u2f_end"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", GROUP="audio", MODE="0666", SYMLINK+="rtl_sdr"
'';
security.pam.u2f.enable = true;
environment.systemPackages = with pkgs; [
libu2f-host
];
}

View File

@@ -22,4 +22,11 @@ mkIf true {
allowedUDPPorts = [
];
};
} // {
assertions = [
{
assertion = true;
message = "Assetion toujours valide.";
}
];
}

View File

@@ -62,10 +62,10 @@ let
configurationOptions = {
ipAddress = mkOption {
description = "Adresse IP";
type = lib.types.string;
description = "Adresse IP.";
type = lib.types.str;
};
nix-serve-server = mkEnableOption "nix-serve server";
nix-serve-server = mkEnableOption "nix-serve server.";
nix-serve-client = {
enable = mkEnableOption "nix-serve client";
servers = mkOption {
@@ -76,17 +76,22 @@ let
};
tinc = {
enable = mkEnableOption "Enable tinc service";
enable = mkEnableOption "Enable tinc service.";
dnsFQDN = mkOption {
example = "device.example.net.";
description = "DNS name of host pointing to tunnel IP.";
type = lib.types.str;
};
connectToAddress = mkOption {
default = "";
example = "192.168.1.1";
description = "External address to connect from another node.";
type = lib.types.string;
type = lib.types.str;
};
vpnAddress = mkOption {
example = "192.168.69.69/24";
description = "VPN local node IP address.";
type = lib.types.string;
type = lib.types.str;
};
vpnCidrLength = mkOption {
default = 24;
@@ -100,8 +105,23 @@ let
Mode = router
ConnecTo = bar
'';
description = "Configuration supplémentaire pour tinc";
type = lib.types.string;
description = "Configuration supplémentaire pour tinc.";
type = lib.types.str;
};
};
quagga = {
enable = mkEnableOption "Enable Quagga + BGP service";
bgpConfig = mkOption {
type = types.lines;
default = "";
example =''
router bgp 65001
neighbor 10.0.0.1 remote-as 65001
'';
description = ''
BGP configuration statements.
'';
};
};
@@ -109,7 +129,7 @@ let
enable = mkEnableOption "Activation du démarrage de Windows par Grub";
drive = mkOption {
description = "Lecteur sur lequel est présent le système Windows (au format GRUB)";
type = lib.types.string;
type = lib.types.str;
default = "hd0,1";
};
};
@@ -117,7 +137,7 @@ let
enable = mkEnableOption "Montage de la partition data Windows";
device = mkOption {
description = "Lecteur sur lequel est présent le disque de data Windows";
type = lib.types.string;
type = lib.types.str;
default = "/dev/sda2";
};
};

View File

@@ -13,7 +13,7 @@ mkIf flags.docker {
environment.systemPackages = with pkgs; [
# Ecosystème Docker
docker
python36Packages.docker_compose
docker-compose
];
virtualisation.docker.enable = true;

View File

@@ -30,6 +30,14 @@ mkIf flags.munin {
ignore_file ^sensors_-wrapped$
ignore_file ^.sensors_-wrapped$
'';
extraPlugins = {
chrony = /etc/nixos/base/services/munin-chrony;
chrony_tracking_stratum = /etc/nixos/base/services/munin-chrony-tracking-stratum;
chrony_tracking_ppm = /etc/nixos/base/services/munin-chrony-tracking-ppm;
chrony_tracking_time_ = /etc/nixos/base/services/munin-chrony-tracking-time;
chrony_tracking_time_root = /etc/nixos/base/services/munin-chrony-tracking-time-root;
chrony_tracking_update_time = /etc/nixos/base/services/munin-chrony-tracking-update-time;
};
};
systemd.services.munin-node = {
path = with pkgs; [ munin lm_sensors ];
@@ -48,9 +56,22 @@ mkIf flags.munin {
hosts = ''
[${config.networking.hostName}]
address 127.0.0.1
df._dev_sda2.warning 35
use_node_name yes
#contacts syslog
contacts email
'';
# http://sametmax.com/monitorez-vos-serveurs-avec-munin-et-notifications-par-email/
# http://guide.munin-monitoring.org/en/latest/tutorial/alert.html#syntax-of-warning-and-critical
extraGlobalConfig = ''
contact.email.command ${pkgs.mutt}/bin/mutt -F /etc/nixos/base/services/munin-muttrc -s "Munin notification for ''${var:host}" root@prunetwork.fr
#---
#contact.email.command ${pkgs.mutt}/bin/mutt -F /etc/nixos/base/services/munin-muttrc -s "Munin notification for ${config.networking.hostName}" root@ocean.prunetwork.fr
contact.email.command /run/current-system/sw/bin/mutt -F /etc/nixos/base/services/munin-muttrc -s "Munin notification for ${config.networking.hostName}" root@ocean.prunetwork.fr
contact.syslog.command /run/current-system/sw/bin/logger -p user.crit -t "Munin notification for ${config.networking.hostName}"
#---
contact.email.always_send ok,warning,critical,unknown
contact.syslog.always_send ok,warning,critical,unknown
'';
};

123
services/munin-chrony Executable file
View File

@@ -0,0 +1,123 @@
#!/bin/sh
: <<=cut
=head1 NAME
parse Chrony Tracking output for timeserver status information
=head1 APPLICABLE SYSTEMS
Any system with a local chronyd service.
=head1 CONFIGURATION
No configuration.
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=head1 VERSION
Revision 0.1 2008/08/23 13:06:00 joti
First version only chronyc tracking, autodetection included.
Revision 0.2 2008/10/11 16:09:00 joti
Added scaling of other values to match with frequency, added more description to fields
Revision 0.3 2014/02/16 zjttoefs
reduce forking by using awk
do not limit output precision
add stratum monitoring
detect slow/fast time or freqency and adjust sign of value accordingly
remove commented out code
Revision 0.4 2016/11/10 Lars Kruse
rewrite field handling
use "which" for "chronyc" location
switch from "bash" to "sh"
fix exit code of failing "autoconf"
=head1 AUTHOR
joti
zjttoefs
Lars Kruse <devel@sumpfralle.de>
=cut
CHRONYC="$(which chronyc | head -1)"
# Frequency has extremely higher values than other. Therefore they are fitted by scaling via suitable factors.
# field definitions:
# - munin fieldname
# - factor for graph visualization (all values are supposed to reach a similar dimension)
# - regular expression of the chrony output line (may not contain whitespace, case insensitive)
# - label (may include "%d" for including the factor; may contain whitespace)
fields="stratum 1 ^Stratum Stratum
systime 1000000 ^System.time System Time (us)
offsetlast 1000000 ^Last.offset Last Offset (us)
offsetrms 1000000 ^RMS.offset RMS Offset (us)
frequency 1 ^Frequency Frequency (ppm)
residualfreq 1 ^Residual.freq Residual Freq (ppm)
skew 1 ^Skew Skew (ppm)
rootdelay 1000000 ^Root.delay Root Delay (us)
rootdispersion 1000000 ^Root.dispersion Root Dispersion (us)
updateinterval 1 ^Update.interval Update Interval (s)"
# chrony example output (v2.4.1):
# Reference ID : 131.188.3.221 (ntp1.rrze.uni-erlangen.de)
# Stratum : 2
# Ref time (UTC) : Thu Nov 10 22:39:50 2016
# System time : 0.000503798 seconds slow of NTP time
# Last offset : +0.000254355 seconds
# RMS offset : 0.002186779 seconds
# Frequency : 17.716 ppm slow
# Residual freq : +0.066 ppm
# Skew : 4.035 ppm
# Root delay : 0.042980 seconds
# Root dispersion : 0.005391 seconds
# Update interval : 258.4 seconds
# Leap status : Normal
if [ "$1" = "autoconf" ]; then
if [ -n "$CHRONYC" ] && [ -x "$CHRONYC" ]; then
echo yes
else
echo "no (missing 'chronyc' executable)"
fi
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Chrony Tracking Stats'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel (time,ppm)'
echo 'graph_category time'
echo 'graph_scale no'
echo "$fields" | while read fieldname factor regex label; do
# insert the factor, if "%d" is part of the label
printf "${fieldname}.label $label\n" "$factor"
echo "${fieldname}.type GAUGE"
done
exit 0
fi
chrony_status="$("$CHRONYC" tracking)"
echo "$fields" | while read fieldname factor regex label; do
status_line="$(echo "$chrony_status" | grep -i -- "$regex " | cut -d ":" -f 2-)"
if [ -z "$status_line" ]; then
value="U"
else
# the keyword "slow" indicates negative values
value="$(echo "$status_line" | awk '{ /slow/ ? SIGN=-1 : SIGN=1; print $1 * SIGN * '"$factor"' }')"
fi
echo "${fieldname}.value $value"
done

View File

@@ -0,0 +1,116 @@
#!/bin/sh
: <<=cut
=head1 NAME
parse Chrony Tracking output for timeserver status information
=head1 APPLICABLE SYSTEMS
Any system with a local chronyd service.
=head1 CONFIGURATION
No configuration.
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=head1 VERSION
Revision 0.1 2008/08/23 13:06:00 joti
First version only chronyc tracking, autodetection included.
Revision 0.2 2008/10/11 16:09:00 joti
Added scaling of other values to match with frequency, added more description to fields
Revision 0.3 2014/02/16 zjttoefs
reduce forking by using awk
do not limit output precision
add stratum monitoring
detect slow/fast time or freqency and adjust sign of value accordingly
remove commented out code
Revision 0.4 2016/11/10 Lars Kruse
rewrite field handling
use "which" for "chronyc" location
switch from "bash" to "sh"
fix exit code of failing "autoconf"
=head1 AUTHOR
joti
zjttoefs
Lars Kruse <devel@sumpfralle.de>
=cut
CHRONYC="$(which chronyc | head -1)"
# Frequency has extremely higher values than other. Therefore they are fitted by scaling via suitable factors.
# field definitions:
# - munin fieldname
# - factor for graph visualization (all values are supposed to reach a similar dimension)
# - regular expression of the chrony output line (may not contain whitespace, case insensitive)
# - label (may include "%d" for including the factor; may contain whitespace)
fields="frequency 1 ^Frequency Local Clock Frequency Drift (ppm)
residualfreq 1 ^Residual.freq Residual Freq (ppm)
skew 1 ^Skew Skew (ppm)"
# chrony example output (v2.4.1):
# Reference ID : 131.188.3.221 (ntp1.rrze.uni-erlangen.de)
# Stratum : 2
# Ref time (UTC) : Thu Nov 10 22:39:50 2016
# System time : 0.000503798 seconds slow of NTP time
# Last offset : +0.000254355 seconds
# RMS offset : 0.002186779 seconds
# Frequency : 17.716 ppm slow
# Residual freq : +0.066 ppm
# Skew : 4.035 ppm
# Root delay : 0.042980 seconds
# Root dispersion : 0.005391 seconds
# Update interval : 258.4 seconds
# Leap status : Normal
if [ "$1" = "autoconf" ]; then
if [ -n "$CHRONYC" ] && [ -x "$CHRONYC" ]; then
echo yes
else
echo "no (missing 'chronyc' executable)"
fi
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Chrony Tracking Stats - Frequencies stability'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel (ppm)'
echo 'graph_category time'
echo 'graph_scale no'
echo "$fields" | while read fieldname factor regex label; do
# insert the factor, if "%d" is part of the label
printf "${fieldname}.label $label\n" "$factor"
echo "${fieldname}.type GAUGE"
done
exit 0
fi
chrony_status="$("$CHRONYC" tracking)"
echo "$fields" | while read fieldname factor regex label; do
status_line="$(echo "$chrony_status" | grep -i -- "$regex " | cut -d ":" -f 2-)"
if [ -z "$status_line" ]; then
value="U"
else
# the keyword "slow" indicates negative values
value="$(echo "$status_line" | awk '{ /slow/ ? SIGN=-1 : SIGN=1; print $1 * SIGN * '"$factor"' }')"
fi
echo "${fieldname}.value $value"
done

View File

@@ -0,0 +1,116 @@
#!/bin/sh
: <<=cut
=head1 NAME
parse Chrony Tracking output for timeserver status information
=head1 APPLICABLE SYSTEMS
Any system with a local chronyd service.
=head1 CONFIGURATION
No configuration.
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=head1 VERSION
Revision 0.1 2008/08/23 13:06:00 joti
First version only chronyc tracking, autodetection included.
Revision 0.2 2008/10/11 16:09:00 joti
Added scaling of other values to match with frequency, added more description to fields
Revision 0.3 2014/02/16 zjttoefs
reduce forking by using awk
do not limit output precision
add stratum monitoring
detect slow/fast time or freqency and adjust sign of value accordingly
remove commented out code
Revision 0.4 2016/11/10 Lars Kruse
rewrite field handling
use "which" for "chronyc" location
switch from "bash" to "sh"
fix exit code of failing "autoconf"
=head1 AUTHOR
joti
zjttoefs
Lars Kruse <devel@sumpfralle.de>
=cut
CHRONYC="$(which chronyc | head -1)"
# Frequency has extremely higher values than other. Therefore they are fitted by scaling via suitable factors.
# field definitions:
# - munin fieldname
# - factor for graph visualization (all values are supposed to reach a similar dimension)
# - regular expression of the chrony output line (may not contain whitespace, case insensitive)
# - label (may include "%d" for including the factor; may contain whitespace)
fields="stratum 1 ^Stratum Stratum"
# chrony example output (v2.4.1):
# Reference ID : 131.188.3.221 (ntp1.rrze.uni-erlangen.de)
# Stratum : 2
# Ref time (UTC) : Thu Nov 10 22:39:50 2016
# System time : 0.000503798 seconds slow of NTP time
# Last offset : +0.000254355 seconds
# RMS offset : 0.002186779 seconds
# Frequency : 17.716 ppm slow
# Residual freq : +0.066 ppm
# Skew : 4.035 ppm
# Root delay : 0.042980 seconds
# Root dispersion : 0.005391 seconds
# Update interval : 258.4 seconds
# Leap status : Normal
if [ "$1" = "autoconf" ]; then
if [ -n "$CHRONYC" ] && [ -x "$CHRONYC" ]; then
echo yes
else
echo "no (missing 'chronyc' executable)"
fi
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Chrony Tracking Stats - Stratum'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel (stratum)'
echo 'graph_category time'
echo 'graph_scale no'
echo 'stratum.warning 8'
echo 'stratum.critical 11'
echo "$fields" | while read fieldname factor regex label; do
# insert the factor, if "%d" is part of the label
printf "${fieldname}.label $label\n" "$factor"
echo "${fieldname}.type GAUGE"
done
exit 0
fi
chrony_status="$("$CHRONYC" tracking)"
echo "$fields" | while read fieldname factor regex label; do
status_line="$(echo "$chrony_status" | grep -i -- "$regex " | cut -d ":" -f 2-)"
if [ -z "$status_line" ]; then
value="U"
else
# the keyword "slow" indicates negative values
value="$(echo "$status_line" | awk '{ /slow/ ? SIGN=-1 : SIGN=1; print $1 * SIGN * '"$factor"' }')"
fi
echo "${fieldname}.value $value"
done

View File

@@ -0,0 +1,118 @@
#!/bin/sh
: <<=cut
=head1 NAME
parse Chrony Tracking output for timeserver status information
=head1 APPLICABLE SYSTEMS
Any system with a local chronyd service.
=head1 CONFIGURATION
No configuration.
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=head1 VERSION
Revision 0.1 2008/08/23 13:06:00 joti
First version only chronyc tracking, autodetection included.
Revision 0.2 2008/10/11 16:09:00 joti
Added scaling of other values to match with frequency, added more description to fields
Revision 0.3 2014/02/16 zjttoefs
reduce forking by using awk
do not limit output precision
add stratum monitoring
detect slow/fast time or freqency and adjust sign of value accordingly
remove commented out code
Revision 0.4 2016/11/10 Lars Kruse
rewrite field handling
use "which" for "chronyc" location
switch from "bash" to "sh"
fix exit code of failing "autoconf"
=head1 AUTHOR
joti
zjttoefs
Lars Kruse <devel@sumpfralle.de>
=cut
CHRONYC="$(which chronyc | head -1)"
# Frequency has extremely higher values than other. Therefore they are fitted by scaling via suitable factors.
# field definitions:
# - munin fieldname
# - factor for graph visualization (all values are supposed to reach a similar dimension)
# - regular expression of the chrony output line (may not contain whitespace, case insensitive)
# - label (may include "%d" for including the factor; may contain whitespace)
fields="systime 1000000 ^System.time System Time (us)
offsetlast 1000000 ^Last.offset Last Offset (us)
offsetrms 1000000 ^RMS.offset RMS Offset (us)
rootdelay 1000000 ^Root.delay Root Delay (us)
rootdispersion 1000000 ^Root.dispersion Root Dispersion (us)"
# chrony example output (v2.4.1):
# Reference ID : 131.188.3.221 (ntp1.rrze.uni-erlangen.de)
# Stratum : 2
# Ref time (UTC) : Thu Nov 10 22:39:50 2016
# System time : 0.000503798 seconds slow of NTP time
# Last offset : +0.000254355 seconds
# RMS offset : 0.002186779 seconds
# Frequency : 17.716 ppm slow
# Residual freq : +0.066 ppm
# Skew : 4.035 ppm
# Root delay : 0.042980 seconds
# Root dispersion : 0.005391 seconds
# Update interval : 258.4 seconds
# Leap status : Normal
if [ "$1" = "autoconf" ]; then
if [ -n "$CHRONYC" ] && [ -x "$CHRONYC" ]; then
echo yes
else
echo "no (missing 'chronyc' executable)"
fi
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Chrony Tracking Stats - Time'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel (time)'
echo 'graph_category time'
echo 'graph_scale no'
echo "$fields" | while read fieldname factor regex label; do
# insert the factor, if "%d" is part of the label
printf "${fieldname}.label $label\n" "$factor"
echo "${fieldname}.type GAUGE"
done
exit 0
fi
chrony_status="$("$CHRONYC" tracking)"
echo "$fields" | while read fieldname factor regex label; do
status_line="$(echo "$chrony_status" | grep -i -- "$regex " | cut -d ":" -f 2-)"
if [ -z "$status_line" ]; then
value="U"
else
# the keyword "slow" indicates negative values
value="$(echo "$status_line" | awk '{ /slow/ ? SIGN=-1 : SIGN=1; print $1 * SIGN * '"$factor"' }')"
fi
echo "${fieldname}.value $value"
done

View File

@@ -0,0 +1,115 @@
#!/bin/sh
: <<=cut
=head1 NAME
parse Chrony Tracking output for timeserver status information
=head1 APPLICABLE SYSTEMS
Any system with a local chronyd service.
=head1 CONFIGURATION
No configuration.
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=head1 VERSION
Revision 0.1 2008/08/23 13:06:00 joti
First version only chronyc tracking, autodetection included.
Revision 0.2 2008/10/11 16:09:00 joti
Added scaling of other values to match with frequency, added more description to fields
Revision 0.3 2014/02/16 zjttoefs
reduce forking by using awk
do not limit output precision
add stratum monitoring
detect slow/fast time or freqency and adjust sign of value accordingly
remove commented out code
Revision 0.4 2016/11/10 Lars Kruse
rewrite field handling
use "which" for "chronyc" location
switch from "bash" to "sh"
fix exit code of failing "autoconf"
=head1 AUTHOR
joti
zjttoefs
Lars Kruse <devel@sumpfralle.de>
=cut
CHRONYC="$(which chronyc | head -1)"
# Frequency has extremely higher values than other. Therefore they are fitted by scaling via suitable factors.
# field definitions:
# - munin fieldname
# - factor for graph visualization (all values are supposed to reach a similar dimension)
# - regular expression of the chrony output line (may not contain whitespace, case insensitive)
# - label (may include "%d" for including the factor; may contain whitespace)
fields="rootdelay 1000000 ^Root.delay Root Delay (us)
rootdispersion 1000000 ^Root.dispersion Root Dispersion (us)"
# chrony example output (v2.4.1):
# Reference ID : 131.188.3.221 (ntp1.rrze.uni-erlangen.de)
# Stratum : 2
# Ref time (UTC) : Thu Nov 10 22:39:50 2016
# System time : 0.000503798 seconds slow of NTP time
# Last offset : +0.000254355 seconds
# RMS offset : 0.002186779 seconds
# Frequency : 17.716 ppm slow
# Residual freq : +0.066 ppm
# Skew : 4.035 ppm
# Root delay : 0.042980 seconds
# Root dispersion : 0.005391 seconds
# Update interval : 258.4 seconds
# Leap status : Normal
if [ "$1" = "autoconf" ]; then
if [ -n "$CHRONYC" ] && [ -x "$CHRONYC" ]; then
echo yes
else
echo "no (missing 'chronyc' executable)"
fi
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Chrony Tracking Stats - Root Time'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel (time)'
echo 'graph_category time'
echo 'graph_scale no'
echo "$fields" | while read fieldname factor regex label; do
# insert the factor, if "%d" is part of the label
printf "${fieldname}.label $label\n" "$factor"
echo "${fieldname}.type GAUGE"
done
exit 0
fi
chrony_status="$("$CHRONYC" tracking)"
echo "$fields" | while read fieldname factor regex label; do
status_line="$(echo "$chrony_status" | grep -i -- "$regex " | cut -d ":" -f 2-)"
if [ -z "$status_line" ]; then
value="U"
else
# the keyword "slow" indicates negative values
value="$(echo "$status_line" | awk '{ /slow/ ? SIGN=-1 : SIGN=1; print $1 * SIGN * '"$factor"' }')"
fi
echo "${fieldname}.value $value"
done

View File

@@ -0,0 +1,114 @@
#!/bin/sh
: <<=cut
=head1 NAME
parse Chrony Tracking output for timeserver status information
=head1 APPLICABLE SYSTEMS
Any system with a local chronyd service.
=head1 CONFIGURATION
No configuration.
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=head1 VERSION
Revision 0.1 2008/08/23 13:06:00 joti
First version only chronyc tracking, autodetection included.
Revision 0.2 2008/10/11 16:09:00 joti
Added scaling of other values to match with frequency, added more description to fields
Revision 0.3 2014/02/16 zjttoefs
reduce forking by using awk
do not limit output precision
add stratum monitoring
detect slow/fast time or freqency and adjust sign of value accordingly
remove commented out code
Revision 0.4 2016/11/10 Lars Kruse
rewrite field handling
use "which" for "chronyc" location
switch from "bash" to "sh"
fix exit code of failing "autoconf"
=head1 AUTHOR
joti
zjttoefs
Lars Kruse <devel@sumpfralle.de>
=cut
CHRONYC="$(which chronyc | head -1)"
# Frequency has extremely higher values than other. Therefore they are fitted by scaling via suitable factors.
# field definitions:
# - munin fieldname
# - factor for graph visualization (all values are supposed to reach a similar dimension)
# - regular expression of the chrony output line (may not contain whitespace, case insensitive)
# - label (may include "%d" for including the factor; may contain whitespace)
fields="updateinterval 1 ^Update.interval Update Interval (s)"
# chrony example output (v2.4.1):
# Reference ID : 131.188.3.221 (ntp1.rrze.uni-erlangen.de)
# Stratum : 2
# Ref time (UTC) : Thu Nov 10 22:39:50 2016
# System time : 0.000503798 seconds slow of NTP time
# Last offset : +0.000254355 seconds
# RMS offset : 0.002186779 seconds
# Frequency : 17.716 ppm slow
# Residual freq : +0.066 ppm
# Skew : 4.035 ppm
# Root delay : 0.042980 seconds
# Root dispersion : 0.005391 seconds
# Update interval : 258.4 seconds
# Leap status : Normal
if [ "$1" = "autoconf" ]; then
if [ -n "$CHRONYC" ] && [ -x "$CHRONYC" ]; then
echo yes
else
echo "no (missing 'chronyc' executable)"
fi
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Chrony Tracking Stats - Update interval'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel (time)'
echo 'graph_category time'
echo 'graph_scale no'
echo "$fields" | while read fieldname factor regex label; do
# insert the factor, if "%d" is part of the label
printf "${fieldname}.label $label\n" "$factor"
echo "${fieldname}.type GAUGE"
done
exit 0
fi
chrony_status="$("$CHRONYC" tracking)"
echo "$fields" | while read fieldname factor regex label; do
status_line="$(echo "$chrony_status" | grep -i -- "$regex " | cut -d ":" -f 2-)"
if [ -z "$status_line" ]; then
value="U"
else
# the keyword "slow" indicates negative values
value="$(echo "$status_line" | awk '{ /slow/ ? SIGN=-1 : SIGN=1; print $1 * SIGN * '"$factor"' }')"
fi
echo "${fieldname}.value $value"
done

View File

@@ -18,9 +18,8 @@ mkIf flags.nixos-manual {
# Services
## documentation sur ctrl + alt + F8
services.nixosManual = {
documentation.nixos = {
enable = true;
showManual = true;
};
# Réseau

View File

@@ -16,6 +16,7 @@ mkIf flags.pulseaudio {
environment.systemPackages = with pkgs; [
paprefs # préferences pulseaudio
pavucontrol # mixer pulseaudio
pa_applet # status et contrôle dans le system tray
];
# Pulse Audio

View File

@@ -11,11 +11,20 @@ mkIf flags.scanner {
# Paquets
environment.systemPackages = with pkgs; [
# Driver
hplip # Scanner HP
python27Packages.pyqt4 # dépendance hplip
# Outils pour exploiter les scanners
simple-scan
];
# Services
hardware.sane.enable = true;
services.saned = {
enable = true;
extraConfig = "192.168.0.0/24";
};
# Réseau
networking.firewall = {

View File

@@ -26,6 +26,9 @@ mkIf true {
# Use kernel sandbox mechanisms where possible in unprivilegied processes
# Systrace on OpenBSD, Seccomp on Linux, seatbelt on MacOSX/Darwin, rlimit elsewhere.
UsePrivilegeSeparation sandbox
# Permet de gérer le nombre de connexions multiplexées en simultané
MaxSessions 200
'';
};
}

View File

@@ -33,7 +33,7 @@ mkIf true {
gnupg opensc pcsctools libu2f-host yubikey-personalization
];
security.pam.enableU2F = true;
security.pam.u2f.enable = true;
/*users.extraUsers.joko = {
isNormalUser = true;