nix: chrony

This commit is contained in:
Geoffrey Frogeye 2023-10-28 19:33:40 +02:00
parent c37a709b01
commit e1788dbd24
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
5 changed files with 10 additions and 51 deletions

View file

@ -1,7 +0,0 @@
server 0.europe.pool.ntp.org offline
server 1.europe.pool.ntp.org offline
server 2.europe.pool.ntp.org offline
server 3.europe.pool.ntp.org offline
driftfile /etc/chrony.drift
rtconutc
rtcsync

View file

@ -1,5 +0,0 @@
if $if_up; then
chronyc online
elif $if_down; then
chronyc offline
fi

View file

@ -79,43 +79,6 @@
### STOPPED HERE ### ### STOPPED HERE ###
# Time synchronisation
- name: Mask systemd-timesyncd
systemd:
name: systemd-timesyncd
state: stopped
enabled: no
masked: yes
become: yes
notify: etc changed
- name: Configure chrony
copy:
src: chrony.conf
dest: /etc/chrony.conf
become: yes
notify:
- etc changed
- chrony reconfigured
# TODO More configuration, RTC configuration
- name: Enable chronyd
systemd:
name: chronyd
enabled: yes
become: yes
notify:
- etc changed
- chrony reconfigured
- name: Configure dhcpcd chrony hook
copy:
src: dhcpcd.exit-hook
dest: /etc/dhcpcd.exit-hook
become: yes
notify: etc changed
- name: Empty motd - name: Empty motd
copy: copy:
content: "" content: ""

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { pkgs, lib, ... }:
{ {
boot.loader.grub.enable = true; boot.loader.grub.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
@ -142,7 +142,14 @@
# Enable the OpenSSH daemon # Enable the OpenSSH daemon
openssh.enable = true; openssh.enable = true;
getty.autologinUser = "geoffrey"; # DEBUG getty.autologinUser = "geoffrey"; # DEBUG
chrony.enable = true;
# Time sychronisation
chrony = {
enable = true;
servers = map (n: "${toString n}.europe.pool.ntp.org") (lib.lists.range 0 3);
extraConfig = "rtcsync";
};
}; };
# TEST # TEST

View file

@ -11,4 +11,5 @@
interfaces = ["eth0"]; interfaces = ["eth0"];
}; };
environment.systemPackages = with pkgs; [ wirelesstools ]; environment.systemPackages = with pkgs; [ wirelesstools ];
services.chrony.serverOption = "offline";
} }