cloudsync command (preliminary; need to automate)

This commit is contained in:
LordGrimmauld 2024-03-04 23:34:26 +01:00
parent 7795f2dda8
commit 2d9173f6be
4 changed files with 29 additions and 0 deletions

View File

@ -56,6 +56,7 @@
./modules/kvm.nix
./modules/toolchains.nix
./modules/tui.nix
./modules/cloudsync.nix
# ./cachix.nix
{ environment.systemPackages = [ agenix.packages.${system}.default ]; }
];

27
modules/cloudsync.nix Normal file
View File

@ -0,0 +1,27 @@
{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 {
# spotify pass
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" ''
# export cloudpass="$(cat ${config.age.secrets.nextcloud_pass.path})"
${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}
'')
];
}

BIN
secrets/nextcloud_pass.age Normal file

Binary file not shown.

View File

@ -2,4 +2,5 @@ let
laptop_pub = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCy7X5ByG4/9y2XkQSnXcpMGnV5WPGUd+B6FaYCDNmPQ7xIZEteS+kCpu9oiMP6C/H/FT+i9DZvCflkzgdFAyujYLKRYaZbZ3K6F60qN0rkJ0z/ZO5c6rqwIwR6BEoB7dq5inkyH9fZ8/SI+PXxELmeWF9ehT7kkQC+o9Ujpcjd7ZuZllbAz4UQZFRbbpwdVJCEDenu9/63yuYbvMupgGk0edaTiFT0Q9MSzs/3pNP8xlAxmmZ3HzSjeF7gUzBF7CaIroTeguiUjSVybUEx48P8fy878t7dUZf4anEno9MS0B3aqfZvCKuuPdAUdeBfCbFHRqN7GuCylFIXGPe95Mxl grimmauld@grimmauld-nixos";
in {
"spotify_pass.age".publicKeys = [ laptop_pub ];
"nextcloud_pass.age".publicKeys = [ laptop_pub ];
}