Compare commits
2 commits
49b8dd0b5e
...
0229cab124
Author | SHA1 | Date | |
---|---|---|---|
|
0229cab124 | ||
|
13eeeabc92 |
|
@ -229,6 +229,7 @@
|
|||
# toolbox
|
||||
imagemagick
|
||||
numbat
|
||||
bc
|
||||
|
||||
# hardware
|
||||
pciutils
|
||||
|
|
|
@ -185,6 +185,7 @@
|
|||
xclip
|
||||
keynav
|
||||
xorg.xinit
|
||||
scrot
|
||||
];
|
||||
sessionVariables = {
|
||||
# XAUTHORITY = "${config.xdg.configHome}/Xauthority"; # Disabled as this causes lock-ups with DMs
|
||||
|
|
|
@ -80,12 +80,6 @@
|
|||
# Enable the OpenSSH daemon
|
||||
openssh.enable = true;
|
||||
|
||||
# Time sychronisation
|
||||
chrony = {
|
||||
enable = true;
|
||||
servers = map (n: "${toString n}.europe.pool.ntp.org") (lib.lists.range 0 3);
|
||||
};
|
||||
|
||||
# Prevent power button from shutting down the computer.
|
||||
# On Pinebook it's too easy to hit,
|
||||
# on others I sometimes turn it off when unsuspending.
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
./battery.nix
|
||||
./boot
|
||||
./ccc
|
||||
./cuda
|
||||
./common.nix
|
||||
./cuda
|
||||
./desktop
|
||||
./dev
|
||||
disko.nixosModules.disko
|
||||
|
@ -18,6 +18,7 @@
|
|||
./remote-builds
|
||||
./style
|
||||
./syncthing
|
||||
./time
|
||||
./wireless
|
||||
];
|
||||
}
|
||||
|
|
47
os/time/default.nix
Normal file
47
os/time/default.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
config = {
|
||||
# Apparently better than reference implementation
|
||||
services.chrony.enable = true;
|
||||
|
||||
networking = {
|
||||
# Using community provided service
|
||||
timeServers = map (n: "${toString n}.europe.pool.ntp.org") (lib.lists.range 0 3);
|
||||
|
||||
# Only try to sync time when we have internet connection
|
||||
dhcpcd.runHook = ''
|
||||
if $if_up
|
||||
then
|
||||
/run/wrappers/bin/sudo ${config.services.chrony.package}/bin/chronyc online
|
||||
elif $if_down
|
||||
then
|
||||
/run/wrappers/bin/sudo ${config.services.chrony.package}/bin/chronyc offline
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
# Allow dhcpcd to control chrony
|
||||
security.sudo.extraRules = [
|
||||
{
|
||||
users = [ "dhcpcd" ];
|
||||
commands =
|
||||
builtins.map
|
||||
(arg: {
|
||||
command = "${config.services.chrony.package}/bin/chronyc ${arg}";
|
||||
options = [ "NOPASSWD" ];
|
||||
|
||||
})
|
||||
[
|
||||
"online"
|
||||
"offline"
|
||||
];
|
||||
}
|
||||
];
|
||||
systemd.services.dhcpcd.serviceConfig.NoNewPrivileges = false;
|
||||
|
||||
};
|
||||
}
|
|
@ -54,15 +54,6 @@ in
|
|||
];
|
||||
# wireless support via wpa_supplicant
|
||||
networking = {
|
||||
# Tell the time synchronisation service when we got/lost the connection
|
||||
dhcpcd.runHook = ''
|
||||
if $if_up; then
|
||||
${config.services.chrony.package}/bin/chronyc online
|
||||
elif $if_down; then
|
||||
${config.services.chrony.package}/bin/chronyc offline
|
||||
fi
|
||||
'';
|
||||
|
||||
wireless = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
|
|
Loading…
Reference in a new issue