Rclone mount

This commit is contained in:
Filippo Berto 2024-11-07 16:18:32 +01:00
parent e42191a53f
commit 6bd039f9b4
No known key found for this signature in database
GPG key ID: FE98AE5EC52B1056
5 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,26 @@
{ pkgs, lib, config, nixosConfig, ... }:
let
rclone_config = nixosConfig.age.secrets."s3_${nixosConfig.networking.hostName}".path;
mounts = { "minio" = "/home/${config.home.username}/minio/"; };
in
{
systemd.user.services = lib.attrsets.mapAttrs'
(name: path: {
name = "rclone-${name}";
value = {
Unit = {
Description = "rclone mount for ${name}";
After = [ "default.target" ];
PartOf = [ "default.target" ];
};
Install.WantedBy = [ "default.target" ];
Service = {
Type = "simple";
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${path}";
ExecStart = "${pkgs.rclone}/bin/rclone --config ${rclone_config} mount ${name}:/ ${path} -v --vfs-cache-mode=writes";
};
};
})
mounts;
}