From 12c176de224592fab228f6d70ab1a8cfd8b6b769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Thu, 22 May 2025 16:42:30 +0200 Subject: [PATCH] Chrony: Consider always online sudo in hook thinks NoNewPrivleges flag is stil active. I don't have it in me to try to fix this, all my computers are more or less always online, and it doesn't sync time often enough to be noticeable on battery (proabably). --- os/time/default.nix | 34 +--------------------------------- os/wireless/default.nix | 3 --- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/os/time/default.nix b/os/time/default.nix index c61be7a..4f8b749 100644 --- a/os/time/default.nix +++ b/os/time/default.nix @@ -1,6 +1,5 @@ { lib, - config, ... }: { @@ -9,39 +8,8 @@ services.chrony.enable = true; networking = { - # Using community provided service + # Using european servers 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; - }; } diff --git a/os/wireless/default.nix b/os/wireless/default.nix index 82f1d52..758c29b 100644 --- a/os/wireless/default.nix +++ b/os/wireless/default.nix @@ -90,9 +90,6 @@ in }; }; - # Wait until there's a connection to fetch time - services.chrony.serverOption = "offline"; - systemd.services.wifi_apply = { after = [ "wpa_supplicant.service" ]; wantedBy = [ "wpa_supplicant.service" ];