Rclone mount
This commit is contained in:
parent
e42191a53f
commit
6bd039f9b4
5 changed files with 42 additions and 0 deletions
26
modules/hm/rclone-mount.nix
Normal file
26
modules/hm/rclone-mount.nix
Normal 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue