Preserve an in-flight timer job during service switching instead of restarting the oneshot and waiting for a potentially long synchronization. Herdr config installation succeeds; the activation timeout occurs later in reloadSystemd. Verified the native keep-old behavior in pinned sources and a focused sd-switch dry run. Formatting, flake evaluation, Zenith build and whitespace checks passed. No live services changed; full activation remains user-controlled.
50 lines
1.5 KiB
Nix
50 lines
1.5 KiB
Nix
{ config, ... }:
|
|
{
|
|
flake.modules.homeManager.sharepoint-reference =
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
rcloneConfig = "${config.xdg.configHome}/rclone/rclone.conf";
|
|
destination = "${config.xdg.dataHome}/yookr-reference/sharepoint";
|
|
in
|
|
{
|
|
systemd.user.services.sharepoint-reference-sync = {
|
|
Unit = {
|
|
Description = "Refresh the local SharePoint reference mirror";
|
|
ConditionPathExists = rcloneConfig;
|
|
# Let an in-flight sync finish; activation must not restart and wait for it.
|
|
X-SwitchMethod = "keep-old";
|
|
};
|
|
|
|
Service = {
|
|
Type = "oneshot";
|
|
UMask = "0077";
|
|
ExecStart = [
|
|
"${lib.getExe pkgs.rclone} --config ${rcloneConfig} sync company-sharepoint: ${destination}/Algemeen --max-delete 100"
|
|
"${lib.getExe pkgs.rclone} --config ${rcloneConfig} sync company-sharepoint-projecten: ${destination}/Projecten --max-delete 100"
|
|
];
|
|
};
|
|
};
|
|
|
|
systemd.user.timers.sharepoint-reference-sync = {
|
|
Unit.Description = "Refresh the local SharePoint reference mirror hourly";
|
|
|
|
Timer = {
|
|
OnCalendar = "hourly";
|
|
Persistent = true;
|
|
RandomizedDelaySec = "10m";
|
|
};
|
|
|
|
Install.WantedBy = [ "timers.target" ];
|
|
};
|
|
};
|
|
|
|
flake.modules.nixos.sharepoint-reference = {
|
|
home-manager.sharedModules = [ config.flake.modules.homeManager.sharepoint-reference ];
|
|
};
|
|
}
|