grimm-nixos-laptop/modules/cloudsync.nix

26 lines
1019 B
Nix
Raw Normal View History

{pkgs, config, ... }: let
# cloud_cmd = "${pkgs.nextcloud-client}/bin/nextcloudcmd -h -n --path";
sync_user = "grimmauld";
sync_user_remote = "Grimmauld";
sync_server = "cloud.grimmauld.de";
# cloud_cmd = "${pkgs.nextcloud-client}/bin/nextcloudcmd -u ${sync_user_remote} -p -h -n --path";
in {
age.secrets.nextcloud_pass = {
file = ../secrets/nextcloud_pass.age;
owner = sync_user;
mode = "700";
};
environment.systemPackages = let
cloud_cmd = ''${pkgs.nextcloud-client}/bin/nextcloudcmd -u ${sync_user_remote} -p "$(cat ${config.age.secrets.nextcloud_pass.path})" -h -n --path'';
in with pkgs; [
nextcloud-client
(writeShellScriptBin "cloudsync" ''
${cloud_cmd} /3d /home/${sync_user}/3d https://${sync_server}
${cloud_cmd} /Pictures /home/${sync_user}/Pictures https://${sync_server}
${cloud_cmd} /Documents /home/${sync_user}/Documents https://${sync_server}
${cloud_cmd} /Videos /home/${sync_user}/Videos https://${sync_server}
'')
];
}