mount sharepoint instead
This commit is contained in:
1 parent
7f37c01ef4
commit
08ae8b7882
2 files changed
+37
-34
No files matched your search
@@ -10,37 +10,35 @@
|
||||
let
|
||||
rcloneConfig = "${config.xdg.configHome}/rclone/rclone.conf";
|
||||
destination = "${config.xdg.dataHome}/yookr-reference/sharepoint";
|
||||
libraries = {
|
||||
Algemeen = "company-sharepoint:";
|
||||
Projecten = "company-sharepoint-projecten:";
|
||||
};
|
||||
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";
|
||||
};
|
||||
systemd.user.services = lib.mapAttrs' (
|
||||
name: remote:
|
||||
lib.nameValuePair "sharepoint-reference-${lib.toLower name}" {
|
||||
Unit = {
|
||||
Description = "SharePoint ${name} on-demand reference mount";
|
||||
ConditionPathExists = rcloneConfig;
|
||||
};
|
||||
|
||||
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"
|
||||
];
|
||||
};
|
||||
};
|
||||
Service = {
|
||||
Type = "notify";
|
||||
UMask = "0077";
|
||||
Environment = "PATH=/run/wrappers/bin:${lib.makeBinPath [ pkgs.fuse3 ]}";
|
||||
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${destination}/${name}";
|
||||
# Stream reads into memory; never retain file contents in a disk cache.
|
||||
# Keep the mount read-only, matching its role as reference material.
|
||||
ExecStart = "${lib.getExe pkgs.rclone} mount ${remote} ${destination}/${name} --config ${rcloneConfig} --read-only --vfs-cache-mode off --buffer-size 16M --dir-cache-time 5m --umask 077";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "30s";
|
||||
};
|
||||
|
||||
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" ];
|
||||
};
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
}
|
||||
) libraries;
|
||||
};
|
||||
|
||||
flake.modules.nixos.sharepoint-reference = {
|
||||
|
||||
Reference in new issue
Block a user